!188 upgrade from 4.4.1 to 5.1.4

Merge pull request !188 from cyberbox/upgrade
This commit is contained in:
openharmony_ci 2024-05-09 07:34:34 +00:00 committed by Gitee
commit f8e0f6a2c8
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
3635 changed files with 206331 additions and 93632 deletions

128
BUILD.gn
View File

@ -34,7 +34,10 @@ libffmpeg_media_aarch64_sources = [
"//third_party/ffmpeg/libavcodec/aarch64/hpeldsp_init_aarch64.c",
"//third_party/ffmpeg/libavcodec/aarch64/hpeldsp_neon.S",
"//third_party/ffmpeg/libavcodec/aarch64/idctdsp_init_aarch64.c",
"//third_party/ffmpeg/libavcodec/aarch64/idctdsp_neon.S",
"//third_party/ffmpeg/libavcodec/aarch64/mdct_neon.S",
"//third_party/ffmpeg/libavcodec/aarch64/me_cmp_init_aarch64.c",
"//third_party/ffmpeg/libavcodec/aarch64/me_cmp_neon.S",
"//third_party/ffmpeg/libavcodec/aarch64/mpegaudiodsp_init.c",
"//third_party/ffmpeg/libavcodec/aarch64/mpegaudiodsp_neon.S",
"//third_party/ffmpeg/libavcodec/aarch64/opusdsp_init.c",
@ -258,7 +261,8 @@ ohos_source_set("ffmpeg_dynamic") {
"//third_party/ffmpeg/libavcodec/avdct.c",
"//third_party/ffmpeg/libavcodec/avfft.c",
"//third_party/ffmpeg/libavcodec/avpacket.c",
"//third_party/ffmpeg/libavcodec/avpicture.c",
#"//third_party/ffmpeg/libavcodec/avpicture.c",
# "//third_party/ffmpeg/libavcodec/avrndec.c",
# "//third_party/ffmpeg/libavcodec/avs.c",
@ -274,7 +278,8 @@ ohos_source_set("ffmpeg_dynamic") {
# "//third_party/ffmpeg/libavcodec/bintext.c",
# "//third_party/ffmpeg/libavcodec/bitpacked.c",
"//third_party/ffmpeg/libavcodec/bitstream.c",
"//third_party/ffmpeg/libavcodec/bitstream_filter.c",
#"//third_party/ffmpeg/libavcodec/bitstream_filter.c",
"//third_party/ffmpeg/libavcodec/bitstream_filters.c",
"//third_party/ffmpeg/libavcodec/blockdsp.c",
"//third_party/ffmpeg/libavcodec/bmp.c",
@ -354,6 +359,11 @@ ohos_source_set("ffmpeg_dynamic") {
# "//third_party/ffmpeg/libavcodec/dds.c",
"//third_party/ffmpeg/libavcodec/decode.c",
"//third_party/ffmpeg/libavcodec/get_buffer.c",
"//third_party/ffmpeg/libavcodec/mpeg4audio_sample_rates.c",
"//third_party/ffmpeg/libavcodec/mpegvideo_dec.c",
"//third_party/ffmpeg/libavcodec/speedhqenc.c",
"//third_party/ffmpeg/libavcodec/vlc.c",
# "//third_party/ffmpeg/libavcodec/dfa.c",
"//third_party/ffmpeg/libavcodec/dirac.c",
@ -361,7 +371,8 @@ ohos_source_set("ffmpeg_dynamic") {
# "//third_party/ffmpeg/libavcodec/dirac_arith.c",
# "//third_party/ffmpeg/libavcodec/dirac_dwt.c",
# "//third_party/ffmpeg/libavcodec/dirac_parser.c",
# "//third_party/ffmpeg/libavcodec/dirac_vlc.c",
"//third_party/ffmpeg/libavcodec/dirac_vlc.c",
# "//third_party/ffmpeg/libavcodec/diracdec.c",
# "//third_party/ffmpeg/libavcodec/diracdsp.c",
# "//third_party/ffmpeg/libavcodec/diractab.c",
@ -443,8 +454,9 @@ ohos_source_set("ffmpeg_dynamic") {
"//third_party/ffmpeg/libavcodec/flacenc.c",
# "//third_party/ffmpeg/libavcodec/flicvideo.c",
# "//third_party/ffmpeg/libavcodec/flvdec.c",
# "//third_party/ffmpeg/libavcodec/flvenc.c",
"//third_party/ffmpeg/libavcodec/flvdec.c",
"//third_party/ffmpeg/libavcodec/flvenc.c",
# "//third_party/ffmpeg/libavcodec/fmtconvert.c",
# "//third_party/ffmpeg/libavcodec/fmvc.c",
"//third_party/ffmpeg/libavcodec/frame_thread_encoder.c",
@ -472,11 +484,11 @@ ohos_source_set("ffmpeg_dynamic") {
# "//third_party/ffmpeg/libavcodec/gsm_parser.c",
# "//third_party/ffmpeg/libavcodec/gsmdec.c",
# "//third_party/ffmpeg/libavcodec/gsmdec_data.c",
# "//third_party/ffmpeg/libavcodec/h261.c",
# "//third_party/ffmpeg/libavcodec/h261_parser.c",
# "//third_party/ffmpeg/libavcodec/h261data.c",
# "//third_party/ffmpeg/libavcodec/h261dec.c",
# "//third_party/ffmpeg/libavcodec/h261enc.c",
"//third_party/ffmpeg/libavcodec/h261.c",
"//third_party/ffmpeg/libavcodec/h261_parser.c",
"//third_party/ffmpeg/libavcodec/h261data.c",
"//third_party/ffmpeg/libavcodec/h261dec.c",
"//third_party/ffmpeg/libavcodec/h261enc.c",
"//third_party/ffmpeg/libavcodec/h263.c",
"//third_party/ffmpeg/libavcodec/h263_parser.c",
"//third_party/ffmpeg/libavcodec/h263data.c",
@ -497,6 +509,7 @@ ohos_source_set("ffmpeg_dynamic") {
"//third_party/ffmpeg/libavcodec/h264_parser.c",
"//third_party/ffmpeg/libavcodec/h264_picture.c",
"//third_party/ffmpeg/libavcodec/h264_ps.c",
"//third_party/ffmpeg/libavcodec/h274.c",
# "//third_party/ffmpeg/libavcodec/h264_redundant_pps_bsf.c",
"//third_party/ffmpeg/libavcodec/h264_refs.c",
@ -562,11 +575,12 @@ ohos_source_set("ffmpeg_dynamic") {
# "//third_party/ffmpeg/libavcodec/indeo3.c",
# "//third_party/ffmpeg/libavcodec/indeo4.c",
# "//third_party/ffmpeg/libavcodec/indeo5.c",
# "//third_party/ffmpeg/libavcodec/intelh263dec.c",
"//third_party/ffmpeg/libavcodec/intelh263dec.c",
# "//third_party/ffmpeg/libavcodec/interplayacm.c",
# "//third_party/ffmpeg/libavcodec/interplayvideo.c",
# "//third_party/ffmpeg/libavcodec/intrax8.c",
# "//third_party/ffmpeg/libavcodec/intrax8dsp.c",
"//third_party/ffmpeg/libavcodec/intrax8.c",
"//third_party/ffmpeg/libavcodec/intrax8dsp.c",
"//third_party/ffmpeg/libavcodec/ituh263dec.c",
"//third_party/ffmpeg/libavcodec/ituh263enc.c",
@ -582,8 +596,9 @@ ohos_source_set("ffmpeg_dynamic") {
# "//third_party/ffmpeg/libavcodec/jpeg2000dec.c",
# "//third_party/ffmpeg/libavcodec/jpeg2000dsp.c",
# "//third_party/ffmpeg/libavcodec/jpeg2000dwt.c",
# "//third_party/ffmpeg/libavcodec/jpegls.c",
# "//third_party/ffmpeg/libavcodec/jpeglsdec.c",
"//third_party/ffmpeg/libavcodec/jpegls.c",
"//third_party/ffmpeg/libavcodec/jpeglsdec.c",
# "//third_party/ffmpeg/libavcodec/jpeglsenc.c",
"//third_party/ffmpeg/libavcodec/jpegtables.c",
"//third_party/ffmpeg/libavcodec/jrevdct.c",
@ -631,10 +646,10 @@ ohos_source_set("ffmpeg_dynamic") {
# "//third_party/ffmpeg/libavcodec/mjpegbdec.c",
"//third_party/ffmpeg/libavcodec/mjpegdec.c",
"//third_party/ffmpeg/libavcodec/mjpegdec_common.c",
"//third_party/ffmpeg/libavcodec/mjpegenc.c",
"//third_party/ffmpeg/libavcodec/mjpegenc_common.c",
"//third_party/ffmpeg/libavcodec/mjpegenc_huffman.c",
# "//third_party/ffmpeg/libavcodec/mjpegenc.c",
# "//third_party/ffmpeg/libavcodec/mjpegenc_common.c",
# "//third_party/ffmpeg/libavcodec/mjpegenc_huffman.c",
# "//third_party/ffmpeg/libavcodec/mlp.c",
# "//third_party/ffmpeg/libavcodec/mlp_parse.c",
# "//third_party/ffmpeg/libavcodec/mlp_parser.c",
@ -656,8 +671,7 @@ ohos_source_set("ffmpeg_dynamic") {
"//third_party/ffmpeg/libavcodec/mpeg12.c",
"//third_party/ffmpeg/libavcodec/mpeg12data.c",
"//third_party/ffmpeg/libavcodec/mpeg12dec.c",
# "//third_party/ffmpeg/libavcodec/mpeg12enc.c",
"//third_party/ffmpeg/libavcodec/mpeg12enc.c",
"//third_party/ffmpeg/libavcodec/mpeg12framerate.c",
# "//third_party/ffmpeg/libavcodec/mpeg2_metadata_bsf.c",
@ -697,10 +711,11 @@ ohos_source_set("ffmpeg_dynamic") {
# "//third_party/ffmpeg/libavcodec/mqcdec.c",
# "//third_party/ffmpeg/libavcodec/mqcenc.c",
# "//third_party/ffmpeg/libavcodec/msgsmdec.c",
# "//third_party/ffmpeg/libavcodec/msmpeg4.c",
# "//third_party/ffmpeg/libavcodec/msmpeg4data.c",
# "//third_party/ffmpeg/libavcodec/msmpeg4dec.c",
# "//third_party/ffmpeg/libavcodec/msmpeg4enc.c",
"//third_party/ffmpeg/libavcodec/msmpeg4.c",
"//third_party/ffmpeg/libavcodec/msmpeg4data.c",
"//third_party/ffmpeg/libavcodec/msmpeg4dec.c",
"//third_party/ffmpeg/libavcodec/msmpeg4enc.c",
# "//third_party/ffmpeg/libavcodec/msrle.c",
"//third_party/ffmpeg/libavcodec/msrledec.c",
@ -741,6 +756,7 @@ ohos_source_set("ffmpeg_dynamic") {
# "//third_party/ffmpeg/libavcodec/pafaudio.c",
# "//third_party/ffmpeg/libavcodec/pafvideo.c",
# "//third_party/ffmpeg/libavcodec/pamenc.c",
"//third_party/ffmpeg/libavcodec/amr_parser.c",
"//third_party/ffmpeg/libavcodec/parser.c",
"//third_party/ffmpeg/libavcodec/parsers.c",
@ -793,7 +809,7 @@ ohos_source_set("ffmpeg_dynamic") {
# "//third_party/ffmpeg/libavcodec/ra144enc.c",
# "//third_party/ffmpeg/libavcodec/ra288.c",
# "//third_party/ffmpeg/libavcodec/ralf.c",
# "//third_party/ffmpeg/libavcodec/rangecoder.c",
"//third_party/ffmpeg/libavcodec/rangecoder.c",
"//third_party/ffmpeg/libavcodec/ratecontrol.c",
"//third_party/ffmpeg/libavcodec/raw.c",
@ -813,9 +829,10 @@ ohos_source_set("ffmpeg_dynamic") {
# "//third_party/ffmpeg/libavcodec/roqvideoenc.c",
# "//third_party/ffmpeg/libavcodec/rpza.c",
# "//third_party/ffmpeg/libavcodec/rtjpeg.c",
# "//third_party/ffmpeg/libavcodec/rv10.c",
# "//third_party/ffmpeg/libavcodec/rv10enc.c",
# "//third_party/ffmpeg/libavcodec/rv20enc.c",
"//third_party/ffmpeg/libavcodec/rv10.c",
"//third_party/ffmpeg/libavcodec/rv10enc.c",
"//third_party/ffmpeg/libavcodec/rv20enc.c",
# "//third_party/ffmpeg/libavcodec/rv30.c",
# "//third_party/ffmpeg/libavcodec/rv30dsp.c",
# "//third_party/ffmpeg/libavcodec/rv34.c",
@ -852,13 +869,15 @@ ohos_source_set("ffmpeg_dynamic") {
# "//third_party/ffmpeg/libavcodec/smacker.c",
# "//third_party/ffmpeg/libavcodec/smc.c",
# "//third_party/ffmpeg/libavcodec/snappy.c",
# "//third_party/ffmpeg/libavcodec/snow.c",
# "//third_party/ffmpeg/libavcodec/snow_dwt.c",
# "//third_party/ffmpeg/libavcodec/snowdec.c",
# "//third_party/ffmpeg/libavcodec/snowenc.c",
"//third_party/ffmpeg/libavcodec/snow.c",
"//third_party/ffmpeg/libavcodec/snow_dwt.c",
"//third_party/ffmpeg/libavcodec/snowdec.c",
"//third_party/ffmpeg/libavcodec/snowenc.c",
# "//third_party/ffmpeg/libavcodec/sonic.c",
# "//third_party/ffmpeg/libavcodec/sp5xdec.c",
# "//third_party/ffmpeg/libavcodec/speedhq.c",
"//third_party/ffmpeg/libavcodec/sp5xdec.c",
"//third_party/ffmpeg/libavcodec/speedhq.c",
# "//third_party/ffmpeg/libavcodec/srtdec.c",
# "//third_party/ffmpeg/libavcodec/srtenc.c",
"//third_party/ffmpeg/libavcodec/startcode.c",
@ -924,7 +943,8 @@ ohos_source_set("ffmpeg_dynamic") {
# "//third_party/ffmpeg/libavcodec/vc1_mc.c",
# "//third_party/ffmpeg/libavcodec/vc1_parser.c",
# "//third_party/ffmpeg/libavcodec/vc1_pred.c",
# "//third_party/ffmpeg/libavcodec/vc1data.c",
"//third_party/ffmpeg/libavcodec/vc1data.c",
# "//third_party/ffmpeg/libavcodec/vc1dec.c",
# "//third_party/ffmpeg/libavcodec/vc1dsp.c",
# "//third_party/ffmpeg/libavcodec/vc2enc.c",
@ -991,11 +1011,12 @@ ohos_source_set("ffmpeg_dynamic") {
# "//third_party/ffmpeg/libavcodec/wmalosslessdec.c",
# "//third_party/ffmpeg/libavcodec/wmaprodec.c",
# "//third_party/ffmpeg/libavcodec/wmavoice.c",
# "//third_party/ffmpeg/libavcodec/wmv2.c",
# "//third_party/ffmpeg/libavcodec/wmv2data.c",
# "//third_party/ffmpeg/libavcodec/wmv2dec.c",
# "//third_party/ffmpeg/libavcodec/wmv2dsp.c",
# "//third_party/ffmpeg/libavcodec/wmv2enc.c",
"//third_party/ffmpeg/libavcodec/wmv2.c",
"//third_party/ffmpeg/libavcodec/wmv2data.c",
"//third_party/ffmpeg/libavcodec/wmv2dec.c",
"//third_party/ffmpeg/libavcodec/wmv2dsp.c",
"//third_party/ffmpeg/libavcodec/wmv2enc.c",
# "//third_party/ffmpeg/libavcodec/wnv1.c",
# "//third_party/ffmpeg/libavcodec/wrapped_avframe.c",
# "//third_party/ffmpeg/libavcodec/ws-snd1.c",
@ -1029,6 +1050,7 @@ ohos_source_set("ffmpeg_dynamic") {
"//third_party/ffmpeg/libavfilter/avfiltergraph.c",
"//third_party/ffmpeg/libavfilter/buffersink.c",
"//third_party/ffmpeg/libavfilter/buffersrc.c",
"//third_party/ffmpeg/libavfilter/colorspace.c",
"//third_party/ffmpeg/libavfilter/drawutils.c",
"//third_party/ffmpeg/libavfilter/fifo.c",
"//third_party/ffmpeg/libavfilter/formats.c",
@ -1128,9 +1150,10 @@ ohos_source_set("ffmpeg_dynamic") {
# "//third_party/ffmpeg/libavformat/dss.c",
# "//third_party/ffmpeg/libavformat/dtsdec.c",
# "//third_party/ffmpeg/libavformat/dtshddec.c",
"//third_party/ffmpeg/libavformat/ac3_channel_layout_tab.c",
"//third_party/ffmpeg/libavformat/dump.c",
"//third_party/ffmpeg/libavformat/dv.c",
# "//third_party/ffmpeg/libavformat/dv.c",
# "//third_party/ffmpeg/libavformat/dvbsub.c",
# "//third_party/ffmpeg/libavformat/dvenc.c",
# "//third_party/ffmpeg/libavformat/dxa.c",
@ -1154,7 +1177,8 @@ ohos_source_set("ffmpeg_dynamic") {
# "//third_party/ffmpeg/libavformat/flacenc_header.c",
# "//third_party/ffmpeg/libavformat/flic.c",
"//third_party/ffmpeg/libavformat/flvdec.c",
"//third_party/ffmpeg/libavformat/flvenc.c",
# "//third_party/ffmpeg/libavformat/flvenc.c",
"//third_party/ffmpeg/libavformat/format.c",
# "//third_party/ffmpeg/libavformat/framecrcenc.c",
@ -1250,10 +1274,12 @@ ohos_source_set("ffmpeg_dynamic") {
# "//third_party/ffmpeg/libavformat/mms.c",
# "//third_party/ffmpeg/libavformat/mmsh.c",
# "//third_party/ffmpeg/libavformat/mmst.c",
"//third_party/ffmpeg/libavformat/dovi_isom.c",
"//third_party/ffmpeg/libavformat/mov.c",
"//third_party/ffmpeg/libavformat/mov_chan.c",
"//third_party/ffmpeg/libavformat/mov_esds.c",
"//third_party/ffmpeg/libavformat/movenc.c",
"//third_party/ffmpeg/libavformat/movenc_ttml.c",
"//third_party/ffmpeg/libavformat/movenccenc.c",
"//third_party/ffmpeg/libavformat/movenchint.c",
"//third_party/ffmpeg/libavformat/mp3dec.c",
@ -1436,9 +1462,9 @@ ohos_source_set("ffmpeg_dynamic") {
# "//third_party/ffmpeg/libavformat/sol.c",
# "//third_party/ffmpeg/libavformat/soxdec.c",
# "//third_party/ffmpeg/libavformat/soxenc.c",
# "//third_party/ffmpeg/libavformat/spdif.c",
# "//third_party/ffmpeg/libavformat/spdifdec.c",
# "//third_party/ffmpeg/libavformat/spdifenc.c",
"//third_party/ffmpeg/libavformat/spdif.c",
"//third_party/ffmpeg/libavformat/spdifdec.c",
"//third_party/ffmpeg/libavformat/spdifenc.c",
"//third_party/ffmpeg/libavformat/srtdec.c",
"//third_party/ffmpeg/libavformat/srtenc.c",
@ -1476,6 +1502,8 @@ ohos_source_set("ffmpeg_dynamic") {
"//third_party/ffmpeg/libavformat/url.c",
# "//third_party/ffmpeg/libavformat/urldecode.c",
"//third_party/ffmpeg/libavformat/demux.c",
"//third_party/ffmpeg/libavformat/seek.c",
"//third_party/ffmpeg/libavformat/utils.c",
# "//third_party/ffmpeg/libavformat/v210.c",
@ -1493,7 +1521,14 @@ ohos_source_set("ffmpeg_dynamic") {
# "//third_party/ffmpeg/libavformat/vpk.c",
# "//third_party/ffmpeg/libavformat/vplayerdec.c",
# "//third_party/ffmpeg/libavformat/vqf.c",
# "//third_party/ffmpeg/libavformat/w64.c",
"//third_party/ffmpeg/libavformat/asf_tags.c",
"//third_party/ffmpeg/libavformat/avformat.c",
"//third_party/ffmpeg/libavformat/dca_sample_rate_tab.c",
"//third_party/ffmpeg/libavformat/demux_utils.c",
"//third_party/ffmpeg/libavformat/mpegaudiotabs.c",
"//third_party/ffmpeg/libavformat/mux_utils.c",
"//third_party/ffmpeg/libavformat/to_upper4.c",
"//third_party/ffmpeg/libavformat/w64.c",
"//third_party/ffmpeg/libavformat/wavdec.c",
# "//third_party/ffmpeg/libavformat/wavenc.c",
@ -1563,6 +1598,7 @@ ohos_source_set("ffmpeg_dynamic") {
"//third_party/ffmpeg/libavutil/log2_tab.c",
# "//third_party/ffmpeg/libavutil/lzo.c",
"//third_party/ffmpeg/libavutil/csp.c",
"//third_party/ffmpeg/libavutil/mastering_display_metadata.c",
"//third_party/ffmpeg/libavutil/mathematics.c",
"//third_party/ffmpeg/libavutil/md5.c",

View File

@ -1,6 +1,6 @@
See the Git history of the project (git://source.ffmpeg.org/ffmpeg) to
See the Git history of the project (https://git.ffmpeg.org/ffmpeg) to
get the names of people who have contributed to FFmpeg.
To check the log, you can type the command "git log" in the FFmpeg
source directory, or browse the online repository at
http://source.ffmpeg.org.
https://git.ffmpeg.org/ffmpeg

517
Changelog
View File

@ -1,194 +1,335 @@
Entries are sorted chronologically from oldest to youngest within each release,
releases are sorted from youngest to oldest.
version 4.4.1:
- avcodec/flac_parser: Consider AV_INPUT_BUFFER_PADDING_SIZE
- avcodec/ttadsp: Fix integer overflows in tta_filter_process_c()
- avutil/mathematics: Document av_rescale_rnd() behavior on non int64 results
- avcodec/utils: Ensure 8x8 alignment for ARGO in avcodec_align_dimensions2()
- avformat/matroskadec: Reset state also on failure in matroska_reset_status()
- avformat/wavdec: Check smv_block_size
- avformat/rmdec: Check for multiple audio_stream_info
- avcodec/apedec: Use 64bit to avoid overflow
- avcodec/apedec: Fix undefined integer overflow in long_filter_ehigh_3830()
- oavformat/avidec: Check offset in odml
- avformat/mpegts: use actually read packet size in mpegts_resync special case
- fftools/ffmpeg: Fix crash when flushing non-fully setup output stream
- avfilter/scale_npp: fix non-aligned output frame dimensions
- Revert "avformat/hlsenc: compute video_keyframe_size after write keyframe"
- Changelog: update
- swscale/alphablend: Fix slice handling
- avcodec/apedec: Fix integer overflow in filter_fast_3320()
- avformat/mov: Fix last mfra check
- avcodec/mxpegdec: Check for AVDISCARD_ALL
- avcodec/flicvideo: Check remaining bytes in FLI*COPY
- avcodec/utils: ARGO writes 4x4 blocks without regard to the image dimensions
- avcodec/cbs_h265_syntax_template: Limit sps_num_palette_predictor_initializer_minus1 to 127
- avcodec/snowdec: Maintain avmv buffer
- avcodec/mpeg12dec: Do not put mpeg_f_code into an invalid state on error return
- avcodec/mpegvideo_enc: Limit bitrate tolerance to the representable
- avcodec/apedec: Fix integer overflow in intermediate
- avformat/mvdec: Do not set invalid sample rate
- avformat/sbgdec: Check for t0 overflow in expand_tseq()
- avformat/rmdec: Use 64bit for intermediate for DEINT_ID_INT4
- avformat/sbgdec: Check opt_duration and start for overflow
- avcodec/exr: Fix undefined integer multiplication
- avformat/mov: Check for duplicate clli
- avformat/utils: Ignore negative duration in codec_info_duration computation
- avformat/jacosubdec: Check for min in t overflow in get_shift()
- avformat/mxfdec: check channel number in mxf_get_d10_aes3_packet()
- (origin/release/4.4) avcodec/wmadec: handle run_level_decode error
- avcodec/wma: Return specific error code
- avcodec/dxva2_av1: fix superres_denom parameter
- avcodec/libdav1d: fix compilation after recent libdav1d API changes
- Changelog: update
- avcodec/utils: don't return negative values in av_get_audio_frame_duration()
- avcodec/jpeg2000dec: Check that atom header is within bytsetream
- avcodec/apedec: Fix 2 integer overflows in filter_3800()
- avcodec/xpmdec: Move allocations down after more error checks
- avcodec/argo: Move U, fix shift
- avformat/mov: Check dts for overflow in mov_read_trun()
- avformat/avidec: Use 64bit for frame number in odml index parsing
- avcodec/mjpegbdec: Skip SOS on AVDISCARD_ALL as does mjpeg
- avcodec/mjpegdec: Check for bits left in mjpeg_decode_scan_progressive_ac()
- avformat/adtsenc: return value check for init_get_bits in adts_decode_extradata
- avcodec/webp: Check available space in loop in decode_entropy_coded_image()
- avcodec/h264dec: use picture parameters in ff_print_debug_info2()
- avcodec/vc1dec: ff_print_debug_info() does not support WMV3 field_mode
- avcodec/frame_thread_encoder: Free AVCodecContext structure on error during init
- avcodec/faxcompr: Check for end of input in cmode == 1 in decode_group3_2d_line()
- avcodec/vc1dec: Disable error concealment for *IMAGE
- avcodec/sbrdsp_fixed: Fix negation overflow in sbr_neg_odd_64_c()
- avcodec/argo: Check for even dimensions
- avformat/wtvdec: Check for EOF before seeking back in parse_media_type()
- avformat/mpc8: Check first keyframe position for overflow
- avcodec/exr: Check ac_count
- avformat/wavdec: Use 64bit in new_pos computation
- avformat/sbgdec: Check for overflow in timestamp preparation
- avformat/dsicin: Check packet size for overflow
- avformat/dsfdec: Change order of operations in bitrate computation
- avformat/bfi: check nframes
- avformat/avidec: fix position overflow in avi_load_index()
- avformat/asfdec_f: Check sizeX against padding
- avformat/aiffdec: Check for size overflow in header parsing
- avcodec/aaccoder: Add minimal bias in search_for_ms()
- avformat/mov: Fix incorrect overflow detection in mov_read_sidx()
- avformat/mov: Avoid undefined overflow in time_offset calculation
- avfilter/af_drmeter: Check that there is data
- avfilter/vf_fftdnoiz: Use lrintf() in export_row8()
- avfilter/vf_mestimate: Check b_count
- avformat/mov: do not ignore errors in mov_metadata_hmmt()
- avformat/mxfdec: Check size for shrinking
- avcodec/dnxhddec: check and propagate function return value
- swscale/slice: Fix wrong return on error
- avcodec/aacdec_template: Avoid some invalid values to be set by decode_audio_specific_config_gb()
- swscale/slice: Check slice for allocation failure
- avformat/matroskadec: Fix handling of huge default durations
- avcodec/lpc: check for zero err in normalization in compute_lpc_coefs()
- avcodec/j2kenc: Check for av_strtok() failure
- avformat/ftp: Check for av_strtok() failure
- tools/cws2fws: Check read() for failure
- avcodec/cpia: Fix missing src_size update
- avcodec/exr: Better size checks
- avcodec/clearvideo: Check tile_size to be not too large
- avcodec/utils: Use 64bit for intermediate in AV_CODEC_ID_ADPCM_THP* duration calculation
- avformat/aaxdec: Check avio_seek() in header reading
- avcodec/hevc_sei: Use get_bits_long() for time_offset_value
- avformat/rmdec: Check old_format len for overflow
- avformat/realtextdec: Check the pts difference before using it for the duration computation
- avformat/qcp: Avoid negative nb_rates
- avformat/pp_bnk: Use 64bit in bitrate computation
- avformat/nutdec: Check tmp_size
- avformat/msf: Check that channels doesnt overflow during extradata construction
- avformat/subtitles: Check pts difference before use
- avformat/mpc8: Check for position overflow in mpc8_handle_chunk()
- avformat/mccdec: Fix overflows in num/den
- avformat/iff: Use 64bit in duration computation
- avformat/dxa: Check fps to be within the supported range more precissely
- avcodec/iff: Only write palette to plane 1 if its PAL8
- avformat/tta: Check for EOF in index reading loop
- avfilter/vf_scale: set the RGB matrix coefficients in case of RGB
- avfilter/vf_scale: reset color matrix in case of identity & non-RGB
- ffmpeg: fix order between field order autodetection and override
- avcodec/h264_slice: clear old slice POC values on parsing failure
- avfilter/f_metadata: do not return the frame early if there is no metadata
- ffbuild: Avoid using the --preprocessor argument to windres
- avcodec/crystalhd: signal that the decoder sets all output frame properties
- avcodec/cuviddec: signal that the decoder sets all output frame properties
- avcodec/decode: reindent after the previous commit
- avcodec/decode: add an internal codec flag to signal a decoder sets all output frame properties
- avcodec/decode: fetch packets from the pkt_props FIFO on every frame returned
- Update missed irc links
- avformat/rpl: The associative law doesnt hold for signed integers in C
- avcodec/faxcompr: Check available bits in decode_uncompressed()
- avcodec/faxcompr: Check if bits are available before reading in cmode == 9 || cmode == 10
- avformat/utils: Avoid overflow in codec_info_duration computation for subtitles
- avformat/utils: check dts/duration to be representable before using them
- avcodec/utils: do "calc from frame_bytes, channels, and block_align" in 64bit
- avcodec/ttadata: Add sentinel at the end of ff_tta_shift_1
- avformat/mov: Check for duplicate mdcv
- avfilter/vf_dctdnoiz: Check threads
- avfilter/vf_ciescope: Fix undefined behavior in rgb_to_xy() with black
- avcodec/dpx: fix off by 1 in bits_per_color check
- avformat/rpl: Check for EOF and zero framesize
- avcodec/vc2enc: Check for non negative slice bounds
- avformat/rpl: Use 64bit in bitrate computation and check it
- avcodec/mpegvideo_enc: Reset stuffing bits if they are not supported
- avcodec/svq1enc: Do not print debug RD value before it has been computed
- avcodec/aacpsy: Check bandwidth
- avcodec/aacenc: Do not divide by lambda_count if it is 0
- avcodec/aacenc: Use FLT_EPSILON for lambda minimum
- avfilter/vf_yadif: Fix handing of tiny images
- avfilter/vf_vmafmotion: Check dimensions
- avformat/movenc: Check pal_size before use
- avcodec/lpc: Avoid floating point division by 0
- avcodec/aacpsy: Avoid floating point division by 0 of norm_fac
- avcodec/aacenc: Avoid 0 lambda
- avcodec/exr: More strictly check dc_count
- avcodec/exr: x/ymax cannot be INT_MAX
- avformat/avio: Check av_opt_copy() for failure
- avformat/moflex: Remove unneeded format variable
- avformat/fifo: check for flushed packets and timeshift
- avcodec/clearvideo: Check for 0 tile_shift
- avcodec/vc1: Check remaining bits in ff_vc1_parse_frame_header()
- avformat/mov: Ignore duplicate CoLL
- avformat/mov: Limit nb_chapter_tracks to input size
- avformat/utils: Use 64bit earlier in r_frame_rate check
- avcodec/alsdec: Fix decoding error with mono audio files
- avformat/mvdec: Check sample rate in parse_audio_var()
- avcodec/faxcompr: Check for end of bitstream in decode_group3_1d_line() and decode_group3_2d_line()
- avcodec/utils: treat PAL8 for jpegs similar to other colorspaces
- avcodec/jpeglsdec: Set alpha plane in PAL8 so image is not 100% transparent
- avformat/asfdec_o: Use ff_get_extradata()
- avformat/id3v2: Check end for overflow in id3v2_parse()
- avformat/mxfdec: Fix file position addition
- avformat/wtvdec: Improve size overflow checks in parse_chunks()
- avcodec/faxcompr: Check remaining bits on error in decode_group3_1d_line()
- avformat/mov: check for pts overflow in mov_read_sidx()
- avcodec/utils: Check ima wav duration for overflow
- avcodec/rv10: Execute whole size check earlier for rv20
- avformat/cafdec: Check channels
- avcodec/exr: increase vlc depth
- avcodec/dpx: Check bits_per_color earlier
- avformat/mvi: Check audio_data_size to be non negative
- avcodec/nvenc: disable s12m timestamps by default
- aarch64: hevc_idct: Fix overflows in idct_dc
- avcodec/vaapi_av1: pass full buffer size for each tile
- avcodec/videotoolboxenc: #define TARGET_CPU_ARM64 to 0 if not provided by the SDK
- lavc/pngdec: fix updating reference frames for APNG_DISPOSE_OP_BACKGROUND
- ffmpeg: return no chosen output if an uninitialized stream is unavailable
- avcodec/h263, h263data: Move ff_h263_init_rl_inter to h263.c
- configure: Add missing mpegvideo dependency for IPU decoder
- avcodec/ttmlenc: Don't confuse capabilities and caps_internal
- avformat/mpegts: add missing sample_rate value to Opus extradata
- avformat/movenc: fix writing dOps atoms
- avcodec/av1_metadata: don't store the inserted TD OBU in stack
- avcodec/nellymoserenc: Fix segfault when using unsupported channels/rate
- avutil/cpu: Use HW_NCPUONLINE to detect # of online CPUs with OpenBSD
- avcodec/nvenc: fix lossless tuning logic
- avfilter/overlay_cuda: check av_buffer_ref result
- avfilter/overlay_cuda: hold explicit reference to hw_device_ctx
- avformat/matroskaenc: Fix leak when writing attachment without filename
version 5.1.4:
avcodec/4xm: Check for cfrm exhaustion
avformat/mov: Disallow FTYP after streams
doc/html: fix styling issue with Texinfo 7.0
doc/html: support texinfo 7.0
avfilter/buffersink: fix order of operation with = and <0
tools/target_dec_fuzzer: Adjust threshold for CSCD
avcodec/dovi_rpu: Use 64 bit in get_us/se_coeff()
avformat/mov: Check that is_still_picture_avif has no trak based streams
avformat/matroskadec: Fix declaration-after-statement warnings
avformat/rtsp: Use rtsp_st->stream_index
avcodec/jpeg2000dec: Check image offset
avformat/mxfdec: Check klv offset
libavutil/ppc/cpu.c: check that AT_HWCAP2 is defined
avcodec/h2645_parse: Avoid EAGAIN
avcodec/xvididct: Make c* unsigned to avoid undefined overflows
avformat/tmv: Check video chunk size
avcodec/h264_parser: saturate dts a bit
avformat/asfdec_f: Saturate presentation time in marker
avformat/xwma: sanity check bits_per_coded_sample
avformat/matroskadec: Check prebuffered_ns for overflow
avformat/wavdec: Check left avio_tell for overflow
avformat/tta: Better totalframes check
avformat/rpl: Check for number_of_chunks overflow
avformat/mov: compute absolute dts difference without overflow in mov_find_next_sample()
avformat/jacosubdec: Check timeres
avformat/jacosubdec: avoid signed integer overflows in get_shift()
avformat/jacosubdec: Factorize code in get_shift() a bit
avformat/sbgdec: Check for negative duration or un-representable end pts
avcodec/escape124: Do not return random numbers
avcodec/apedec: Fix an integer overflow in predictor_update_filter()
tools/target_dec_fuzzer: Adjust wmapro threshold
avformat/avs: Check if return code is representable
avcodec/lcldec: Make PNG filter addressing match the code afterwards
avformat/westwood_vqa: Check chunk size
avformat/sbgdec: Check for period overflow
avformat/concatdec: Check in/outpoint for overflow
avformat/mxfdec: Remove this_partition
avcodec/xvididct: Fix integer overflow in idct_row()
avcodec/celp_math: avoid overflow in shift
tools/target_dec_fuzzer: Adjust threshold for rtv1
avformat/hls: reduce default max reload to 3
avformat/format: Stop reading data at EOF during probing
avcodec/jpeg2000dec: jpeg2000 has its own lowres option
avcodec/huffyuvdec: avoid undefined behavior with get_vlc2() failure
avcodec/cscd: Fix "CamStudio Lossless Codec 1.0" gzip files
avcodec/cscd: Check for CamStudio Lossless Codec 1.0 behavior in end check of LZO files
avcodec/mpeg4videodec: consider lowres in dest_pcm[]
avcodec/hevcdec: Fix undefined memcpy()
avcodec/mpeg4videodec: more unsigned in amv computation
avcodec/tta: fix signed overflow in decorrelate
avcodec/apedec: Fix 48khz 24bit below insane level
avcodec/apedec: Fix CRC for 24bps and bigendian
avcodec/xvididct: Fix integer overflow in idct_row()
avformat/avr: Check sample rate
avformat/imf_cpl: Replace NULL content_title_utf8 by ""
avformat/imf_cpl: xmlNodeListGetString() can return NULL
avcodec/pcm: allow Changing parameters
avcodec/jpeg2000dec: Check for reduction factor and image offset
avutil/softfloat: Basic documentation for av_sincos_sf()
avutil/softfloat: fix av_sincos_sf()
tools/target_dec_fuzzer: Adjust threshold for speex
avcodec/utils: fix 2 integer overflows in get_audio_frame_duration()
avcodec/hevcdec: Avoid null pointer dereferences in MC
avcodec/takdsp: Fix integer overflows
avcodec: Ignoring errors is only possible before the input end
avformat/jpegxl_probe: Forward error codes
avformat/jpegxl_probe: check length instead of blindly reading
avformat/jpegxl_probe: Remove intermediate macro obfuscation around get_bits*()
avcodec/noise_bsf: Check for wrapped frames
avformat/oggparsetheora: clip duration within 64bit
avformat/wavdec: Check that smv block fits in available space
avcodec/tiff: add a zero DNG_LINEARIZATION_TABLE check
avcodec/tak: Check remaining bits in ff_tak_decode_frame_header()
avcodec/sonic: Fix two undefined integer overflows
avcodec/utils: the IFF_ILBM implementation assumes that there are a multiple of 16 allocated
avcodec/exr: Cleanup befor return
avcodec/pngdec: Do not pass AVFrame into global header decode
avcodec/pngdec: remove AVFrame argument from decode_iccp_chunk()
avcodec/vorbisdec: Check codebook float values to be finite
avcodec/g2meet: Replace fake allocation avoidance for framebuf
avutil/tx_priv: Use unsigned in BF() to avoid signed overflows
avcodec/lcldec: More space for rgb24
avcodec/lcldec: Support 4:1:1 and 4:2:2 with odd width
libavcodec/lcldec: width and height should not be unsigned
avformat/imf: fix invalid resource handling
avcodec/escape124: Check that blocks are allocated before use
avcodec/huffyuvdec: Fix undefined behavior with shift
avcodec/j2kenc: Replace RGB24 special case by generic test
avcodec/j2kenc: Replace BGR48 / GRAY16 test by test for number of bits
avcodec/j2kenc: simplify pixel format setup
avcodec/j2kenc: Fix funky bpno errors on decoding
avcodec/j2kenc: remove misleading pred value
avcodec/j2kenc: fix 5/3 DWT identifer
avcodec/vp3: Check width to avoid assertion failure
avcodec/g729postfilter: Limit shift in long term filter
configure: update copyright year
Changelog: Add forgotten line
libavformat/riffec: Zero-initialize channels in ff_get_wav_header
avcodec/x86/mathops: clip constants used with shift instructions within inline assembly
avcodec/libsvtav1: use larger of bit rate and max rate for buffer size
avcodec/libsvtav1: only set max_buf_sz if both bitrate and rc_buf_sz is set
avcodec/libsvtav1: remove compressed_ten_bit_format and simplify alloc_buffer
avcodec/libsvtav1: replace vbv_bufsize with maximum_buffer_size_ms
avcodec/vdpau_mpeg4: fix order of quant matrix coefficients
avcodec/vdpau_mpeg12: fix order of quant matrix coefficients
avcodec/nvdec_mpeg4: fix order of quant matrix coefficients
avcodec/nvdec_mpeg2: fix order of quant matrix coefficients
fftools/ffmpeg: avoid possible invalid reads with short -tag values
avcodec/mp_cmp: reject invalid comparison function values
avcodec/aacpsy: clip global_quality within the psy_vbr_map array boundaries
avutil/wchar_filename: propagate MultiByteToWideChar() and WideCharToMultiByte() failures
avformat/concatf: check if any nodes were allocated
avcodec/nvenc: fix b-frame DTS behavior with fractional framerates
version 5.1.3:
- avcodec/tests/snowenc: Fix 2nd test
- avcodec/tests/snowenc: return a failure if DWT/IDWT mismatches
- avcodec/snowenc: Fix visual weight calculation
- avcodec/tests/snowenc: unbreak DWT tests
- avfilter/vf_untile: swap the chroma shift values used for plane offsets
- update for 5.1.3
- avcodec/mpeg12dec: Check input size
- avcodec/escape124: Fix some return codes
- avcodec/escape124: fix signdness of end of input check
- Use https for repository links
- avcodec/rpzaenc: stop accessing out of bounds frame
- avcodec/smcenc: stop accessing out of bounds frame
- avcodec/motionpixels: Mask pixels to valid values
- avcodec/xpmdec: Check size before allocation to avoid truncation
- avcodec/bink: Avoid undefined out of array end pointers in binkb_decode_plane()
- avcodec/bink: Fix off by 1 error in ref end
- avcodec/utils: Ensure linesize for SVQ3
- avcodec/utils: allocate a line more for VC1 and WMV3
- avcodec/videodsp_template: Adjust pointers to avoid undefined pointer things
- avcodec/pngdec: dont skip/read chunk twice
- avcodec/pngdec: Check deloco index more exactly
- avcodec/ffv1dec: Check that num h/v slices is supported
- avformat/mov: Check samplesize and offset to avoid integer overflow
- lavu/vulkan: fix handle type for 32-bit targets
- vulkan: Fix win/i386 calling convention
- avcodec/pictordec: Remove mid exit branch
- avcodec/eac3dec: avoid float noise in fixed mode addition to overflow
- avcodec/utils: use 32pixel alignment for bink
- avcodec/scpr3: Check bx
- avcodec/012v: Order operations for odd size handling
- avcodec/eatgq: : Check index increments in tgq_decode_block()
- avcodec/h274: fix include
- avcodec/scpr: Test bx before use
- avformat/mxfdec: Use 64bit in remainder
- avcodec/sunrast: Fix maplength check
- avcodec/wavpack: Avoid undefined shift in get_tail()
- avcodec/wavpack: Check for end of input in wv_unpack_dsd_high()
- avformat/id3v2: Check taglen in read_uslt()
- avcodec/tiff: Ignore tile_count
- avcodec/ffv1dec: restructure slice coordinate reading a bit
- avcodec/mlpdec: Check max matrix instead of max channel in noise check
- avutil/tx: Use unsigned in ff_tx_fft_sr_combine() to avoid undefined behavior
- swscale/input: Use more unsigned intermediates
- avcodec/alsdec: Check bits left before block decoding in non multi channel coding loop
- avcodec/alsdec: The minimal block is at least 7 bits
- avformat/replaygain: avoid undefined / negative abs
- swscale/output: Bias 16bps output calculations to improve non overflowing range for GBRP16/GBRPF32
- swscale/output: Bias 16bps output calculations to improve non overflowing range
- avcodec/speedhq: Check buf_size to be big enough for DC
- avcodec/ffv1dec: Fail earlier if prior context is corrupted
- avcodec/speexdec: Check channels > 2
- avformat/vividas: Check packet size
- hwcontext_vulkan: remove optional encode/decode extensions from the list
- avcodec/libjxldec: fix gamma22 and gamma28 recognition
- avcodec/mpeg12dec: use init_get_bits8 and check the return value
- avcodec/nvenc: fix vbv buffer size in cq mode
- avcodec/mjpegenc: take into account component count when writing the SOF header size
- swscale: aarch64: Fix yuv2rgb with negative strides
- avcodec/atrac3plus: reorder channels to match the output layout
- avcodec/aacdec: fix parsing streams with channel configuration 11
- libswscale: force a minimum size of the slide for bayer sources
- lavf/async: Fix ring_write return value
- avcodec/audiotoolboxenc: return AVERROR_EXTERNAL immediately when encode error
- avcodec/libjxlenc: avoid hard failure with unspecified primaries
version 5.1.2:
- avcodec/dstdec: Check for overflow in build_filter()
- avformat/spdifdec: Use 64bit to compute bit rate
- avformat/rpl: Use 64bit for duration computation
- avformat/xwma: Use av_rescale() for duration computation
- avformat/sdsdec: Use av_rescale() to avoid intermediate overflow in duration calculation
- avformat/sbgdec: Check ts_int in genrate_intervals
- avformat/sbgdec: clamp end_ts
- avformat/rmdec: check tag_size
- avformat/nutdec: Check fields
- avformat/flvdec: Use 64bit for sum_flv_tag_size
- avformat/jacosubdec: Fix overflow in get_shift()
- avformat/genh: Check nb_channels for IMA ADPCM
- avformat/dxa: avoid bpc overflows
- avformat/dhav: Use 64bit seek_back
- avformat/cafdec: Check that nb_frasmes fits within 64bit
- avformat/asfdec_o: Limit packet offset
- avformat/apm: Use 64bit for bit_rate computation
- avformat/ape: Check frames size
- avformat/icodec: Check nb_pal
- avformat/aiffdec: Use 64bit for block_duration use
- avformat/aiffdec: Check block_duration
- avformat/mxfdec: only probe max run in
- avformat/mxfdec: Check run_in is within 65536
- avcodec/mjpegdec: Check for unsupported bayer case
- avcodec/apedec: Fix integer overflow in filter_3800()
- avcodec/tta: Check 24bit scaling for overflow
- avcodec/mobiclip: Check quantizer for overflow
- avcodec/exr: Check preview psize
- avcodec/tiff: Fix loop detection
- libavformat/hls: Free keys
- avcodec/fmvc: Move frame allocation to a later stage
- avfilter/vf_showinfo: remove backspaces
- avcodec/speedhq: Check width
- avcodec/bink: disallow odd positioned scaled blocks
- avformat/cafenc: derive Opus frame size from the relevant stream parameters
- avformat/dashdec: Fix crash on invalid input/ENOMEM, fix leak
- lavc/videotoolbox: do not pass AVCodecContext to decoder output callback
- lavc/pthread_frame: always transfer stashed hwaccel state
- avcodec/arm/sbcenc: avoid callee preserved vfp registers
- avformat/riffdec: don't unconditionally overwrite WAVEFORMATEXTENSIBLE layout
- avfilter/vf_scale: overwrite the width and height expressions with the original values
- lavc/pthread_frame: avoid leaving stale hwaccel state in worker threads
- avutil/tests/.gitignore: Add channel_layout testtool
version 5.1.1:
- avformat/asfdec_o: limit recursion depth in asf_read_unknown()
- avformat/mov: Check count sums in build_open_gop_key_points()
- doc/git-howto.texi: Document commit signing
- libavcodec/8bps: Check that line lengths fit within the buffer
- avcodec/midivid: Perform lzss_uncompress() before ff_reget_buffer()
- libavformat/iff: Check for overflow in body_end calculation
- avformat/avidec: Prevent entity expansion attacks
- avcodec/h263dec: Sanity check against minimal I/P frame size
- avcodec/hevcdec: Check s->ref in the md5 path similar to hwaccel
- avcodec/mpegaudiodec_template: use unsigned shift in handle_crc()
- avformat/subviewerdec: Make read_ts() more flexible
- avcodec/mjpegdec: bayer and rct are incompatible
- MAINTAINERS: Add ED25519 key for signing my commits in the future
- avcodec/pngdec: Fix APNG_DISPOSE_OP_BACKGROUND
- avcodec/libvpx: fix assembling vp9 packets with alpha channel
- fftools/ffmpeg_opt: try to propagate the requested output channel layout
- avcodec/libsvtav1: properly initialize the flush EbBufferHeaderType struct
- configure: enable the av1_frame_split bsf for the av1 decoder
- swresample/swresample: fill the correct buffer to print the output layout string
- ffprobe: restore reporting error code for failed inputs
- ipfsgateway: Remove default gateway
- avcodec/libspeexdec: Fix use of uninitialized value
- avformat/avisynth: use ch_layout.nb_channels for channel count
- fate/lavf-image: Disable file checksums for exr tests
- tests/fate-run: Allow to skip file checksums for lavf_image
- fate/imf: Rename IMF fate-target
- avcodec/alac: don't fail if channels aren't set during init() when extradata is valid
- configure: properly require libx264 if enabled
version 5.1:
- add ipfs/ipns protocol support
- dialogue enhance audio filter
- dropped obsolete XvMC hwaccel
- pcm-bluray encoder
- DFPWM audio encoder/decoder and raw muxer/demuxer
- SITI filter
- Vizrt Binary Image encoder/decoder
- avsynctest source filter
- feedback video filter
- pixelize video filter
- colormap video filter
- colorchart video source filter
- multiply video filter
- PGS subtitle frame merge bitstream filter
- blurdetect filter
- tiltshelf audio filter
- QOI image format support
- ffprobe -o option
- virtualbass audio filter
- VDPAU AV1 hwaccel
- PHM image format support
- remap_opencl filter
- added chromakey_cuda filter
version 5.0:
- ADPCM IMA Westwood encoder
- Westwood AUD muxer
- ADPCM IMA Acorn Replay decoder
- Argonaut Games CVG demuxer
- Argonaut Games CVG muxer
- Concatf protocol
- afwtdn audio filter
- audio and video segment filters
- Apple Graphics (SMC) encoder
- hsvkey and hsvhold video filters
- adecorrelate audio filter
- atilt audio filter
- grayworld video filter
- AV1 Low overhead bitstream format muxer
- swscale slice threading
- MSN Siren decoder
- scharr video filter
- apsyclip audio filter
- morpho video filter
- amr parser
- (a)latency filters
- GEM Raster image decoder
- asdr audio filter
- speex decoder
- limitdiff video filter
- xcorrelate video filter
- varblur video filter
- huesaturation video filter
- colorspectrum source video filter
- RTP packetizer for uncompressed video (RFC 4175)
- bitpacked encoder
- VideoToolbox VP9 hwaccel
- VideoToolbox ProRes hwaccel
- support loongarch.
- aspectralstats audio filter
- adynamicsmooth audio filter
- libplacebo filter
- vflip_vulkan, hflip_vulkan and flip_vulkan filters
- adynamicequalizer audio filter
- yadif_videotoolbox filter
- VideoToolbox ProRes encoder
- anlmf audio filter
- IMF demuxer (experimental)
version 4.4:
- AudioToolbox output device

View File

@ -138,6 +138,7 @@ Codecs:
8bps.c Roberto Togni
8svx.c Jaikrishnan Menon
aacenc*, aaccoder.c Rostislav Pehlivanov
adpcm.c Zane van Iperen
alacenc.c Jaikrishnan Menon
alsdec.c Thilo Borgmann, Umair Khan
aptx.c Aurelien Jacobs
@ -160,6 +161,7 @@ Codecs:
cscd.c Reimar Doeffinger
cuviddec.c Timo Rothenpieler
dca* foo86
dfpwm* Jack Bruienne
dirac* Rostislav Pehlivanov
dnxhd* Baptiste Coudurier
dolby_e* foo86
@ -192,6 +194,7 @@ Codecs:
libcodec2.c Tomas Härdin
libdirac* David Conrad
libdavs2.c Huiwen Ren
libjxl*.c, libjxl.h Leo Izen
libgsm.c Michel Bardiaux
libkvazaar.c Arttu Ylä-Outinen
libopenh264enc.c Martin Storsjo, Linjie Fu
@ -225,7 +228,7 @@ Codecs:
ptx.c Ivo van Poorten
qcelp* Reynaldo H. Verdejo Pinochet
qdm2.c, qdm2data.h Roberto Togni
qsv* Mark Thompson, Zhong Li
qsv* Mark Thompson, Zhong Li, Haihao Xiang
qtrle.c Mike Melanson
ra144.c, ra144.h, ra288.c, ra288.h Roberto Togni
resample2.c Michael Niedermayer
@ -265,7 +268,6 @@ Codecs:
xan.c Mike Melanson
xbm* Paul B Mahol
xface Stefano Sabatini
xvmc.c Ivan Kalvachev
xwd* Paul B Mahol
Hardware acceleration:
@ -273,8 +275,8 @@ Hardware acceleration:
dxva2* Hendrik Leppkes, Laurent Aimar, Steve Lhomme
d3d11va* Steve Lhomme
mediacodec* Matthieu Bouron, Aman Gupta
vaapi* Gwenole Beauchesne
vaapi_encode* Mark Thompson
vaapi* Haihao Xiang
vaapi_encode* Mark Thompson, Haihao Xiang
vdpau* Philip Langdale, Carl Eugen Hoyos
videotoolbox* Rick Kern, Aman Gupta
@ -353,6 +355,7 @@ Filters:
vf_il.c Paul B Mahol
vf_(t)interlace Thomas Mundt (CC <thomas.mundt@hr.de>)
vf_lenscorrection.c Daniel Oberhoff
vf_libplacebo.c Niklas Haas
vf_mergeplanes.c Paul B Mahol
vf_mestimate.c Davinder Singh
vf_minterpolate.c Davinder Singh
@ -398,6 +401,7 @@ Muxers/Demuxers:
apngdec.c Benoit Fouet
argo_asf.c Zane van Iperen
argo_brp.c Zane van Iperen
argo_cvg.c Zane van Iperen
ass* Aurelien Jacobs
astdec.c Paul B Mahol
astenc.c James Almer
@ -414,6 +418,7 @@ Muxers/Demuxers:
dashdec.c Steven Liu
dashenc.c Karthick Jeyapal
daud.c Reimar Doeffinger
dfpwmdec.c Jack Bruienne
dss.c Oleksij Rempel
dtsdec.c foo86
dtshddec.c Paul B Mahol
@ -434,6 +439,7 @@ Muxers/Demuxers:
ipmovie.c Mike Melanson
ircam* Paul B Mahol
iss.c Stefan Gehrer
jpegxl_probe.* Leo Izen
jvdec.c Peter Ross
kvag.c Zane van Iperen
libmodplug.c Clément Bœsch
@ -513,6 +519,7 @@ Protocols:
bluray.c Petri Hintukainen
ftp.c Lukasz Marek
http.c Ronald S. Bultje
libsrt.c Zhao Zhili
libssh.c Lukasz Marek
libzmq.c Andriy Gelman
mms*.c Ronald S. Bultje
@ -539,6 +546,7 @@ Operating systems / CPU architectures
Alpha Falk Hueffner
MIPS Manojkumar Bhosale, Shiyou Yin
LoongArch Shiyou Yin
Mac OS X / PowerPC Romain Dolbeau, Guillaume Poirier
Amiga / PowerPC Colin Ward
Linux / PowerPC Lauri Kasanen
@ -609,13 +617,17 @@ Daniel Verkamp 78A6 07ED 782C 653E C628 B8B9 F0EB 8DD8 2F0E 21C7
FFmpeg release signing key FCF9 86EA 15E6 E293 A564 4F10 B432 2F04 D676 58D8
Ganesh Ajjanagadde C96A 848E 97C3 CEA2 AB72 5CE4 45F9 6A2D 3C36 FB1B
Gwenole Beauchesne 2E63 B3A6 3E44 37E2 017D 2704 53C7 6266 B153 99C4
Haihao Xiang (haihao) 1F0C 31E8 B4FE F7A4 4DC1 DC99 E0F5 76D4 76FC 437F
Jaikrishnan Menon 61A1 F09F 01C9 2D45 78E1 C862 25DC 8831 AF70 D368
James Almer 7751 2E8C FD94 A169 57E6 9A7A 1463 01AD 7376 59E0
Jean Delvare 7CA6 9F44 60F1 BDC4 1FD2 C858 A552 6B9B B3CD 4E6A
Leo Izen (thebombzen) B6FD 3CFC 7ACF 83FC 9137 6945 5A71 C331 FD2F A19A
Loren Merritt ABD9 08F4 C920 3F65 D8BE 35D7 1540 DAA7 060F 56DE
Lynne FE50 139C 6805 72CA FD52 1F8D A2FE A5F0 3F03 4464
Michael Niedermayer 9FF2 128B 147E F673 0BAD F133 611E C787 040B 0FAB
DD1E C9E8 DE08 5C62 9B3E 1846 B18E 8928 B394 8D64
Nicolas George 24CE 01CE 9ACC 5CEB 74D8 8D9D B063 D997 36E5 4C93
Niklas Haas (haasn) 1DDB 8076 B14D 5B48 32FC 99D9 EB52 DA9C 02BA 6FB4
Nikolay Aleksandrov 8978 1D8C FB71 588E 4B27 EAA8 C4F0 B5FC E011 13B1
Panagiotis Issaris 6571 13A3 33D9 3726 F728 AA98 F643 B12E ECF3 E029
Peter Ross A907 E02F A6E5 0CD2 34CD 20D2 6760 79C5 AC40 DD6B

View File

@ -13,17 +13,19 @@ vpath %.v $(SRC_PATH)
vpath %.texi $(SRC_PATH)
vpath %.cu $(SRC_PATH)
vpath %.ptx $(SRC_PATH)
vpath %.metal $(SRC_PATH)
vpath %/fate_config.sh.template $(SRC_PATH)
TESTTOOLS = audiogen videogen rotozoom tiny_psnr tiny_ssim base64 audiomatch
HOSTPROGS := $(TESTTOOLS:%=tests/%) doc/print_options
ALLFFLIBS = avcodec avdevice avfilter avformat avutil postproc swscale swresample
# $(FFLIBS-yes) needs to be in linking order
FFLIBS-$(CONFIG_AVDEVICE) += avdevice
FFLIBS-$(CONFIG_AVFILTER) += avfilter
FFLIBS-$(CONFIG_AVFORMAT) += avformat
FFLIBS-$(CONFIG_AVCODEC) += avcodec
FFLIBS-$(CONFIG_AVRESAMPLE) += avresample
FFLIBS-$(CONFIG_POSTPROC) += postproc
FFLIBS-$(CONFIG_SWRESAMPLE) += swresample
FFLIBS-$(CONFIG_SWSCALE) += swscale
@ -65,6 +67,8 @@ tools/target_io_dem_fuzzer$(EXESUF): tools/target_io_dem_fuzzer.o $(FF_DEP_LIBS)
tools/enum_options$(EXESUF): ELIBS = $(FF_EXTRALIBS)
tools/enum_options$(EXESUF): $(FF_DEP_LIBS)
tools/scale_slice_test$(EXESUF): $(FF_DEP_LIBS)
tools/scale_slice_test$(EXESUF): ELIBS = $(FF_EXTRALIBS)
tools/sofa2wavs$(EXESUF): ELIBS = $(FF_EXTRALIBS)
tools/uncoded_frame$(EXESUF): $(FF_DEP_LIBS)
tools/uncoded_frame$(EXESUF): ELIBS = $(FF_EXTRALIBS)
@ -74,13 +78,14 @@ tools/target_dem_%_fuzzer$(EXESUF): $(FF_DEP_LIBS)
CONFIGURABLE_COMPONENTS = \
$(wildcard $(FFLIBS:%=$(SRC_PATH)/lib%/all*.c)) \
$(SRC_PATH)/libavcodec/bitstream_filters.c \
$(SRC_PATH)/libavcodec/hwaccels.h \
$(SRC_PATH)/libavcodec/parsers.c \
$(SRC_PATH)/libavformat/protocols.c \
config.h: ffbuild/.config
config_components.h: ffbuild/.config
ffbuild/.config: $(CONFIGURABLE_COMPONENTS)
@-tput bold 2>/dev/null
@-printf '\nWARNING: $(?) newer than config.h, rerun configure\n\n'
@-printf '\nWARNING: $(?) newer than config_components.h, rerun configure\n\n'
@-tput sgr0 2>/dev/null
SUBDIR_VARS := CLEANFILES FFLIBS HOSTPROGS TESTPROGS TOOLS \
@ -88,7 +93,8 @@ SUBDIR_VARS := CLEANFILES FFLIBS HOSTPROGS TESTPROGS TOOLS \
ARMV5TE-OBJS ARMV6-OBJS ARMV8-OBJS VFP-OBJS NEON-OBJS \
ALTIVEC-OBJS VSX-OBJS MMX-OBJS X86ASM-OBJS \
MIPSFPU-OBJS MIPSDSPR2-OBJS MIPSDSP-OBJS MSA-OBJS \
MMI-OBJS OBJS SLIBOBJS HOSTOBJS TESTOBJS
MMI-OBJS LSX-OBJS LASX-OBJS OBJS SLIBOBJS SHLIBOBJS \
STLIBOBJS HOSTOBJS TESTOBJS
define RESET
$(1) :=
@ -110,12 +116,13 @@ include $(SRC_PATH)/fftools/Makefile
include $(SRC_PATH)/doc/Makefile
include $(SRC_PATH)/doc/examples/Makefile
libavcodec/avcodec.o libavformat/utils.o libavdevice/avdevice.o libavfilter/avfilter.o libavutil/utils.o libpostproc/postprocess.o libswresample/swresample.o libswscale/utils.o : libavutil/ffversion.h
$(ALLFFLIBS:%=lib%/version.o): libavutil/ffversion.h
$(PROGS): %$(PROGSSUF)$(EXESUF): %$(PROGSSUF)_g$(EXESUF)
ifeq ($(STRIPTYPE),direct)
$(STRIP) -o $@ $<
else
$(RM) $@
$(CP) $< $@
$(STRIP) $@
endif
@ -156,7 +163,7 @@ clean::
$(RM) -rf coverage.info coverage.info.in lcov
distclean:: clean
$(RM) .version avversion.h config.asm config.h mapfile \
$(RM) .version config.asm config.h config_components.h mapfile \
ffbuild/.config ffbuild/config.* libavutil/avconfig.h \
version.h libavutil/ffversion.h libavcodec/codec_names.h \
libavcodec/bsf_list.c libavformat/protocol_list.c \

View File

@ -3,7 +3,7 @@
"Name": "FFmpeg",
"License": "LGPL V2.1/LGPL V3.0/GPL V2.0/GPL V3.0",
"License File": "COPYING.LGPLv2.1/COPYING.LGPLv3/COPYING.GPLv2/COPYING.GPLv3",
"Version Number": "4.4.1",
"Version Number": "5.1.4",
"Upstream URL": "http://www.ffmpeg.org/",
"Description": "FFmpeg is the leading multimedia framework, able to decode, encode, transcode, mux, demux, stream, filter and play pretty much anything that humans and machines have created."
}

View File

@ -9,7 +9,7 @@ such as audio, video, subtitles and related metadata.
* `libavcodec` provides implementation of a wider range of codecs.
* `libavformat` implements streaming protocols, container formats and basic I/O access.
* `libavutil` includes hashers, decompressors and miscellaneous utility functions.
* `libavfilter` provides a mean to alter decoded Audio and Video through chain of filters.
* `libavfilter` provides means to alter decoded audio and video through a directed graph of connected filters.
* `libavdevice` provides an abstraction to access capture and playback devices.
* `libswresample` implements audio mixing and resampling routines.
* `libswscale` implements color conversion and scaling routines.

View File

@ -1 +1 @@
4.4.1
5.1.4

View File

@ -1,10 +1,13 @@
┌────────────────────────────────────┐
│ RELEASE NOTES for FFmpeg 4.4 "Rao"
└────────────────────────────────────┘
────────────────────────────────────────────┐
│ RELEASE NOTES for FFmpeg 5.1 "Riemann" LTS
────────────────────────────────────────────┘
The FFmpeg Project proudly presents FFmpeg 4.4 "Rao", about 10
months after the release of FFmpeg 4.3.
The FFmpeg Project proudly presents FFmpeg 5.1 "Riemann" LTS, about 6
months after the release of FFmpeg 5.0, our first Long Term Support
release. While several past FFmpeg releases have enjoyed long term
support, this is the first release where such an intention is made
clear at release.
A complete Changelog is available at the root of the project, and the
complete Git history on https://git.ffmpeg.org/gitweb/ffmpeg.git

View File

@ -1,7 +1,7 @@
{
"name": "@ohos/ffmpeg",
"description": "FFmpeg is the leading multimedia framework, able to decode, encode, transcode, mux, demux, stream, filter and play pretty much anything that humans and machines have created.",
"version": "3.1",
"version": "5.1.4",
"license": "LGPL V2.1/LGPL V3.0/GPL V2.0/GPL V3.0",
"publishAs": "code-segment",
"segment": {

View File

@ -96,7 +96,7 @@ do { \
atomic_load(object)
#define atomic_exchange(object, desired) \
InterlockedExchangePointer(object, desired);
InterlockedExchangePointer((PVOID volatile *)object, (PVOID)desired)
#define atomic_exchange_explicit(object, desired, order) \
atomic_exchange(object, desired)

View File

@ -181,8 +181,11 @@ static inline __device__ double trunc(double a) { return __builtin_trunc(a); }
static inline __device__ float fabsf(float a) { return __builtin_fabsf(a); }
static inline __device__ float fabs(float a) { return __builtin_fabsf(a); }
static inline __device__ double fabs(double a) { return __builtin_fabs(a); }
static inline __device__ float sqrtf(float a) { return __builtin_sqrtf(a); }
static inline __device__ float __saturatef(float a) { return __nvvm_saturate_f(a); }
static inline __device__ float __sinf(float a) { return __nvvm_sin_approx_f(a); }
static inline __device__ float __cosf(float a) { return __nvvm_cos_approx_f(a); }
static inline __device__ float __expf(float a) { return __nvvm_ex2_approx_f(a * (float)__builtin_log2(__builtin_exp(1))); }
#endif /* COMPAT_CUDA_CUDA_RUNTIME_H */

View File

@ -59,7 +59,7 @@ int avpriv_vsnprintf(char *s, size_t n, const char *fmt,
* recommends to provide _snprintf/_vsnprintf() a buffer size that
* is one less than the actual buffer, and zero it before calling
* _snprintf/_vsnprintf() to workaround this problem.
* See http://msdn.microsoft.com/en-us/library/1kt27hek(v=vs.80).aspx */
* See https://web.archive.org/web/20151214111935/http://msdn.microsoft.com/en-us/library/1kt27hek(v=vs.80).aspx */
memset(s, 0, n);
va_copy(ap_copy, ap);
ret = _vsnprintf(s, n - 1, fmt, ap_copy);

View File

@ -20,11 +20,40 @@
#define COMPAT_W32DLFCN_H
#ifdef _WIN32
#include <stdint.h>
#include <windows.h>
#include "config.h"
#if (_WIN32_WINNT < 0x0602) || HAVE_WINRT
#include "libavutil/macros.h"
#include "libavutil/wchar_filename.h"
#endif
static inline wchar_t *get_module_filename(HMODULE module)
{
wchar_t *path = NULL, *new_path;
DWORD path_size = 0, path_len;
do {
path_size = path_size ? FFMIN(2 * path_size, INT16_MAX + 1) : MAX_PATH;
new_path = av_realloc_array(path, path_size, sizeof *path);
if (!new_path) {
av_free(path);
return NULL;
}
path = new_path;
// Returns path_size in case of insufficient buffer.
// Whether the error is set or not and whether the output
// is null-terminated or not depends on the version of Windows.
path_len = GetModuleFileNameW(module, path, path_size);
} while (path_len && path_size <= INT16_MAX && path_size <= path_len);
if (!path_len) {
av_free(path);
return NULL;
}
return path;
}
/**
* Safe function used to open dynamic libs. This attempts to improve program security
* by removing the current directory from the dll search path. Only dll's found in the
@ -34,29 +63,53 @@
*/
static inline HMODULE win32_dlopen(const char *name)
{
wchar_t *name_w;
HMODULE module = NULL;
if (utf8towchar(name, &name_w))
name_w = NULL;
#if _WIN32_WINNT < 0x0602
// Need to check if KB2533623 is available
// On Win7 and earlier we check if KB2533623 is available
if (!GetProcAddress(GetModuleHandleW(L"kernel32.dll"), "SetDefaultDllDirectories")) {
HMODULE module = NULL;
wchar_t *path = NULL, *name_w = NULL;
DWORD pathlen;
if (utf8towchar(name, &name_w))
wchar_t *path = NULL, *new_path;
DWORD pathlen, pathsize, namelen;
if (!name_w)
goto exit;
path = (wchar_t *)av_mallocz_array(MAX_PATH, sizeof(wchar_t));
namelen = wcslen(name_w);
// Try local directory first
pathlen = GetModuleFileNameW(NULL, path, MAX_PATH);
pathlen = wcsrchr(path, '\\') - path;
if (pathlen == 0 || pathlen + wcslen(name_w) + 2 > MAX_PATH)
path = get_module_filename(NULL);
if (!path)
goto exit;
path[pathlen] = '\\';
new_path = wcsrchr(path, '\\');
if (!new_path)
goto exit;
pathlen = new_path - path;
pathsize = pathlen + namelen + 2;
new_path = av_realloc_array(path, pathsize, sizeof *path);
if (!new_path)
goto exit;
path = new_path;
wcscpy(path + pathlen + 1, name_w);
module = LoadLibraryExW(path, NULL, LOAD_WITH_ALTERED_SEARCH_PATH);
if (module == NULL) {
// Next try System32 directory
pathlen = GetSystemDirectoryW(path, MAX_PATH);
if (pathlen == 0 || pathlen + wcslen(name_w) + 2 > MAX_PATH)
pathlen = GetSystemDirectoryW(path, pathsize);
if (!pathlen)
goto exit;
path[pathlen] = '\\';
// Buffer is not enough in two cases:
// 1. system directory + \ + module name
// 2. system directory even without the module name.
if (pathlen + namelen + 2 > pathsize) {
pathsize = pathlen + namelen + 2;
new_path = av_realloc_array(path, pathsize, sizeof *path);
if (!new_path)
goto exit;
path = new_path;
// Query again to handle the case #2.
pathlen = GetSystemDirectoryW(path, pathsize);
if (!pathlen)
goto exit;
}
path[pathlen] = L'\\';
wcscpy(path + pathlen + 1, name_w);
module = LoadLibraryExW(path, NULL, LOAD_WITH_ALTERED_SEARCH_PATH);
}
@ -73,16 +126,19 @@ exit:
# define LOAD_LIBRARY_SEARCH_SYSTEM32 0x00000800
#endif
#if HAVE_WINRT
wchar_t *name_w = NULL;
int ret;
if (utf8towchar(name, &name_w))
if (!name_w)
return NULL;
ret = LoadPackagedLibrary(name_w, 0);
av_free(name_w);
return ret;
module = LoadPackagedLibrary(name_w, 0);
#else
return LoadLibraryExA(name, NULL, LOAD_LIBRARY_SEARCH_APPLICATION_DIR | LOAD_LIBRARY_SEARCH_SYSTEM32);
#define LOAD_FLAGS (LOAD_LIBRARY_SEARCH_APPLICATION_DIR | LOAD_LIBRARY_SEARCH_SYSTEM32)
/* filename may be be in CP_ACP */
if (!name_w)
return LoadLibraryExA(name, NULL, LOAD_FLAGS);
module = LoadLibraryExW(name_w, NULL, LOAD_FLAGS);
#undef LOAD_FLAGS
#endif
av_free(name_w);
return module;
}
#define dlopen(name, flags) win32_dlopen(name)
#define dlclose FreeLibrary

2098
config_components.h Normal file

File diff suppressed because it is too large Load Diff

655
configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -2,19 +2,298 @@ Never assume the API of libav* to be stable unless at least 1 month has passed
since the last major version increase or the API was added.
The last version increases were:
libavcodec: 2017-10-21
libavdevice: 2017-10-21
libavfilter: 2017-10-21
libavformat: 2017-10-21
libavresample: 2017-10-21
libpostproc: 2017-10-21
libswresample: 2017-10-21
libswscale: 2017-10-21
libavutil: 2017-10-21
libavcodec: 2021-04-27
libavdevice: 2021-04-27
libavfilter: 2021-04-27
libavformat: 2021-04-27
libpostproc: 2021-04-27
libswresample: 2021-04-27
libswscale: 2021-04-27
libavutil: 2021-04-27
API changes, most recent first:
-------- 8< --------- FFmpeg 5.1 was cut here -------- 8< ---------
2022-06-12 - 7cae3d8b76 - lavf 59.25.100 - avio.h
Add avio_vprintf(), similar to avio_printf() but allow to use it
from within a function taking a variable argument list as input.
2022-06-12 - ff59ecc4de - lavu 57.27.100 - uuid.h
Add UUID handling functions.
Add av_uuid_parse(), av_uuid_urn_parse(), av_uuid_parse_range(),
av_uuid_parse_range(), av_uuid_equal(), av_uuid_copy(), and av_uuid_nil().
2022-06-01 - d42b410e05 - lavu 57.26.100 - csp.h
Add public API for colorspace structs.
Add av_csp_luma_coeffs_from_avcsp(), av_csp_primaries_desc_from_id(),
and av_csp_primaries_id_from_desc().
2022-05-23 - 4cdc14aa95 - lavu 57.25.100 - avutil.h
Deprecate av_fopen_utf8() without replacement.
2022-03-16 - f3a0e2ee2b - all libraries - version_major.h
Add lib<name>/version_major.h as new installed headers, which only
contain the major version number (and corresponding API deprecation
defines).
2022-03-15 - cdba98bb80 - swr 4.5.100 - swresample.h
Add swr_alloc_set_opts2() and swr_build_matrix2().
Deprecate swr_alloc_set_opts() and swr_build_matrix().
2022-03-15 - cdba98bb80 - lavfi 8.28.100 - avfilter.h buffersink.h buffersrc.h
Update AVFilterLink for the new channel layout API: add ch_layout,
deprecate channel_layout.
Update the buffersink filter sink for the new channel layout API:
add av_buffersink_get_ch_layout() and the ch_layouts option,
deprecate av_buffersink_get_channel_layout() and the channel_layouts option.
Update AVBufferSrcParameters for the new channel layout API:
add ch_layout, deprecate channel_layout.
2022-03-15 - cdba98bb80 - lavf 59.19.100 - avformat.h
Add AV_DISPOSITION_NON_DIEGETIC.
2022-03-15 - cdba98bb80 - lavc 59.24.100 - avcodec.h codec_par.h
Update AVCodecParameters for the new channel layout API: add ch_layout,
deprecate channels/channel_layout.
Update AVCodecContext for the new channel layout API: add ch_layout,
deprecate channels/channel_layout.
Update AVCodec for the new channel layout API: add ch_layouts,
deprecate channel_layouts.
2022-03-15 - cdba98bb80 - lavu 57.24.100 - channel_layout.h frame.h opt.h
Add new channel layout API based on the AVChannelLayout struct.
Add support for Ambisonic audio.
Deprecate previous channel layout API based on uint64 bitmasks.
Add AV_OPT_TYPE_CHLAYOUT option type, deprecate AV_OPT_TYPE_CHANNEL_LAYOUT.
Update AVFrame for the new channel layout API: add ch_layout, deprecate
channels/channel_layout.
2022-03-10 - f629ea2e18 - lavu 57.23.100 - cpu.h
Add AV_CPU_FLAG_AVX512ICL.
2022-02-07 - a10f1aec1f - lavu 57.21.100 - fifo.h
Deprecate AVFifoBuffer and the API around it, namely av_fifo_alloc(),
av_fifo_alloc_array(), av_fifo_free(), av_fifo_freep(), av_fifo_reset(),
av_fifo_size(), av_fifo_space(), av_fifo_generic_peek_at(),
av_fifo_generic_peek(), av_fifo_generic_read(), av_fifo_generic_write(),
av_fifo_realloc2(), av_fifo_grow(), av_fifo_drain() and av_fifo_peek2().
Users should switch to the AVFifo-API.
2022-02-07 - 7329b22c05 - lavu 57.20.100 - fifo.h
Add a new FIFO API, which allows setting a FIFO element size.
This API operates on these elements rather than on bytes.
Add av_fifo_alloc2(), av_fifo_elem_size(), av_fifo_can_read(),
av_fifo_can_write(), av_fifo_grow2(), av_fifo_drain2(), av_fifo_write(),
av_fifo_write_from_cb(), av_fifo_read(), av_fifo_read_to_cb(),
av_fifo_peek(), av_fifo_peek_to_cb(), av_fifo_drain2(), av_fifo_reset2(),
av_fifo_freep2(), av_fifo_auto_grow_limit().
2022-01-26 - af94ab7c7c0 - lavu 57.19.100 - tx.h
Add AV_TX_FLOAT_RDFT, AV_TX_DOUBLE_RDFT and AV_TX_INT32_RDFT.
-------- 8< --------- FFmpeg 5.0 was cut here -------- 8< ---------
2022-01-04 - 78dc21b123e - lavu 57.16.100 - frame.h
Add AV_FRAME_DATA_DOVI_METADATA.
2022-01-03 - 70f318e6b6c - lavf 59.13.100 - avformat.h
Add AVFMT_EXPERIMENTAL flag.
2021-12-22 - b7e1ec7bda9 - lavu 57.13.100 - hwcontext_videotoolbox.h
Add av_vt_pixbuf_set_attachments
2021-12-22 - 69bd95dcd8d - lavu 57.13.100 - hwcontext_videotoolbox.h
Add av_map_videotoolbox_chroma_loc_from_av
Add av_map_videotoolbox_color_matrix_from_av
Add av_map_videotoolbox_color_primaries_from_av
Add av_map_videotoolbox_color_trc_from_av
2021-12-21 - ffbab99f2c2 - lavu 57.12.100 - cpu.h
Add AV_CPU_FLAG_SLOW_GATHER.
2021-12-20 - 278068dc60d - lavu 57.11.101 - display.h
Modified the documentation of av_display_rotation_set()
to match its longstanding actual behaviour of treating
the angle as directed clockwise.
2021-12-12 - 64834bb86a1 - lavf 59.10.100 - avformat.h
Add AVFormatContext io_close2 which returns an int
2021-12-10 - f45cbb775e4 - lavu 57.11.100 - hwcontext_vulkan.h
Add AVVkFrame.offset and AVVulkanFramesContext.flags.
2021-12-04 - b9c928a486f - lavfi 8.19.100 - avfilter.h
Add AVFILTER_FLAG_METADATA_ONLY.
2021-12-03 - b236ef0a594 - lavu 57.10.100 - frame.h
Add AVFrame.time_base
2021-11-22 - b2cd1fb2ec6 - lavu 57.9.100 - pixfmt.h
Add AV_PIX_FMT_P210, AV_PIX_FMT_P410, AV_PIX_FMT_P216, and AV_PIX_FMT_P416.
2021-11-17 - 54e65aa38ab - lavf 57.9.100 - frame.h
Add AV_FRAME_DATA_DOVI_RPU_BUFFER.
2021-11-16 - ed75a08d36c - lavf 59.9.100 - avformat.h
Add av_stream_get_class(). Schedule adding AVStream.av_class at libavformat
major version 60.
Add av_disposition_to_string() and av_disposition_from_string().
Add "disposition" AVOption to AVStream's class.
2021-11-12 - 8478d60d5b5 - lavu 57.8.100 - hwcontext_vulkan.h
Added AVVkFrame.sem_value, AVVulkanDeviceContext.queue_family_encode_index,
nb_encode_queues, queue_family_decode_index, and nb_decode_queues.
2021-10-18 - 682bafdb125 - lavf 59.8.100 - avio.h
Introduce public bytes_{read,written} statistic fields to AVIOContext.
2021-10-13 - a5622ed16f8 - lavf 59.7.100 - avio.h
Deprecate AVIOContext.written. Originally added as a private entry in
commit 3f75e5116b900f1428aa13041fc7d6301bf1988a, its grouping with
the comment noting its private state was missed during merging of the field
from Libav (most likely due to an already existing field in between).
2021-09-21 - 0760d9153c3 - lavu 57.7.100 - pixfmt.h
Add AV_PIX_FMT_X2BGR10.
2021-09-20 - 8d5de914d31 - lavu 57.6.100 - mem.h
Deprecate av_mallocz_array() as it is identical to av_calloc().
2021-09-20 - 176b8d785bf - lavc 59.9.100 - avcodec.h
Deprecate AVCodecContext.sub_text_format and the corresponding
AVOptions. It is unused since the last major bump.
2021-09-20 - dd846bc4a91 - lavc 59.8.100 - avcodec.h codec.h
Deprecate AV_CODEC_FLAG_TRUNCATED and AV_CODEC_CAP_TRUNCATED,
as they are redundant with parsers.
2021-09-17 - ccfdef79b13 - lavu 57.5.101 - buffer.h
Constified the input parameters in av_buffer_replace(), av_buffer_ref(),
and av_buffer_pool_buffer_get_opaque().
2021-09-08 - 4f78711f9c2 - lavu 57.5.100 - hwcontext_d3d11va.h
Add AVD3D11VAFramesContext.texture_infos
2021-09-06 - 42cd64c1826 - lsws 6.1.100 - swscale.h
Add AVFrame-based scaling API:
- sws_scale_frame()
- sws_frame_start()
- sws_frame_end()
- sws_send_slice()
- sws_receive_slice()
- sws_receive_slice_alignment()
2021-09-02 - cbf111059d2 - lavc 59.7.100 - avcodec.h
Incremented the number of elements of AVCodecParser.codec_ids to seven.
2021-08-24 - 590a7e02f04 - lavc 59.6.100 - avcodec.h
Add FF_CODEC_PROPERTY_FILM_GRAIN
2021-08-20 - 7c5f998196d - lavfi 8.3.100 - avfilter.H
Add avfilter_filter_pad_count() as a replacement for avfilter_pad_count().
Deprecate avfilter_pad_count().
2021-08-17 - 8c53b145993 - lavu 57.4.101 - opt.h
av_opt_copy() now guarantees that allocated src and dst options
don't alias each other even on error.
2021-08-14 - d5de9965ef6 - lavu 57.4.100 - imgutils.h
Add av_image_copy_plane_uc_from()
2021-08-02 - a1a0fddfd05 - lavc 59.4.100 - packet.h
Add AVPacket.opaque, AVPacket.opaque_ref, AVPacket.time_base.
2021-07-23 - 2dd8acbe800 - lavu 57.3.100 - common.h macros.h
Move several macros (AV_NE, FFDIFFSIGN, FFMAX, FFMAX3, FFMIN, FFMIN3,
FFSWAP, FF_ARRAY_ELEMS, MKTAG, MKBETAG) from common.h to macros.h.
2021-07-22 - e3b5ff17c2e - lavu 57.2.100 - film_grain_params.h
Add AV_FILM_GRAIN_PARAMS_H274, AVFilmGrainH274Params
2021-07-19 - c1bf56a526f - lavu 57.1.100 - cpu.h
Add av_cpu_force_count()
2021-06-17 - aca923b3653 - lavc 59.2.100 - packet.h
Add AV_PKT_DATA_DYNAMIC_HDR10_PLUS
2021-06-09 - 2cccab96f6f - lavf 59.3.100 - avformat.h
Add pts_wrap_bits to AVStream
2021-06-10 - 7c9763070d9 - lavc 59.1.100 - avcodec.h codec.h
Move av_get_profile_name() from avcodec.h to codec.h.
2021-06-10 - bb3648e6766 - lavc 59.1.100 - avcodec.h codec_par.h
Move av_get_audio_frame_duration2() from avcodec.h to codec_par.h.
2021-06-10 - 881db34f6a0 - lavc 59.1.100 - avcodec.h codec_id.h
Move av_get_bits_per_sample(), av_get_exact_bits_per_sample(),
avcodec_profile_name(), and av_get_pcm_codec() from avcodec.h
to codec_id.h.
2021-06-10 - ff0a96046d8 - lavc 59.1.100 - avcodec.h defs.h
Add new installed header defs.h. The following definitions are moved
into it from avcodec.h:
- AVDiscard
- AVAudioServiceType
- AVPanScan
- AVCPBProperties and av_cpb_properties_alloc()
- AVProducerReferenceTime
- av_xiphlacing()
2021-04-27 - cb3ac722f4 - lavc 59.0.100 - avcodec.h
Constified AVCodecParserContext.parser.
2021-04-27 - 8b3e6ce5f4 - lavd 59.0.100 - avdevice.h
The av_*_device_next API functions now accept and return
pointers to const AVInputFormat resp. AVOutputFormat.
2021-04-27 - d7e0d428fa - lavd 59.0.100 - avdevice.h
avdevice_list_input_sources and avdevice_list_output_sinks now accept
pointers to const AVInputFormat resp. const AVOutputFormat.
2021-04-27 - 46dac8cf3d - lavf 59.0.100 - avformat.h
av_find_best_stream now uses a const AVCodec ** parameter
for the returned decoder.
2021-04-27 - 626535f6a1 - lavc 59.0.100 - codec.h
avcodec_find_encoder_by_name(), avcodec_find_encoder(),
avcodec_find_decoder_by_name() and avcodec_find_decoder()
now return a pointer to const AVCodec.
2021-04-27 - 14fa0a4efb - lavf 59.0.100 - avformat.h
Constified AVFormatContext.*_codec.
2021-04-27 - 56450a0ee4 - lavf 59.0.100 - avformat.h
Constified the pointers to AVInputFormats and AVOutputFormats
in AVFormatContext, avformat_alloc_output_context2(),
av_find_input_format(), av_probe_input_format(),
av_probe_input_format2(), av_probe_input_format3(),
av_probe_input_buffer2(), av_probe_input_buffer(),
avformat_open_input(), av_guess_format() and av_guess_codec().
Furthermore, constified the AVProbeData in av_probe_input_format(),
av_probe_input_format2() and av_probe_input_format3().
2021-04-19 - 18af1ea8d1 - lavu 56.74.100 - tx.h
Add AV_TX_FULL_IMDCT and AV_TX_UNALIGNED.
2021-04-17 - f1bf465aa0 - lavu 56.73.100 - frame.h detection_bbox.h
Add AV_FRAME_DATA_DETECTION_BBOXES
2021-04-06 - 557953a397 - lavf 58.78.100 - avformat.h
Add avformat_index_get_entries_count(), avformat_index_get_entry(),
and avformat_index_get_entry_from_timestamp().
2021-03-21 - a77beea6c8 - lavu 56.72.100 - frame.h
Deprecated av_get_colorspace_name().
Use av_color_space_name() instead.
-------- 8< --------- FFmpeg 4.4 was cut here -------- 8< ---------
2021-03-19 - e8c0bca6bd - lavu 56.69.100 - adler32.h
@ -1410,7 +1689,7 @@ API changes, most recent first:
2014-04-15 - ef818d8 - lavf 55.37.101 - avformat.h
Add av_format_inject_global_side_data()
2014-04-12 - 4f698be - lavu 52.76.100 - log.h
2014-04-12 - 4f698be8f - lavu 52.76.100 - log.h
Add av_log_get_flags()
2014-04-11 - 6db42a2b - lavd 55.12.100 - avdevice.h

View File

@ -38,7 +38,7 @@ PROJECT_NAME = FFmpeg
# could be handy for archiving the generated documentation or if some version
# control system is used.
PROJECT_NUMBER = 4.4.1
PROJECT_NUMBER = 5.1.4
# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a

View File

@ -27,6 +27,9 @@ HTMLPAGES = $(AVPROGS-yes:%=doc/%.html) $(AVPROGS-yes:%=doc/%-all.html) $(COMP
doc/mailing-list-faq.html \
doc/nut.html \
doc/platform.html \
$(SRC_PATH)/doc/bootstrap.min.css \
$(SRC_PATH)/doc/style.min.css \
$(SRC_PATH)/doc/default.css \
TXTPAGES = doc/fate.txt \
@ -102,7 +105,7 @@ DOXY_INPUT_DEPS = $(addprefix $(SRC_PATH)/, $(DOXY_INPUT)) ffbuild/config.mak
doc/doxy/html: TAG = DOXY
doc/doxy/html: $(SRC_PATH)/doc/Doxyfile $(SRC_PATH)/doc/doxy-wrapper.sh $(DOXY_INPUT_DEPS)
$(M)OUT_DIR=$$PWD/doc/doxy; cd $(SRC_PATH); ./doc/doxy-wrapper.sh $$OUT_DIR $< $(DOXYGEN) $(DOXY_INPUT);
$(M)$(SRC_PATH)/doc/doxy-wrapper.sh $$PWD/doc/doxy $(SRC_PATH) doc/Doxyfile $(DOXYGEN) $(DOXY_INPUT);
install-doc: install-html install-man

View File

@ -3,9 +3,9 @@
The FFmpeg developers.
For details about the authorship, see the Git history of the project
(git://source.ffmpeg.org/ffmpeg), e.g. by typing the command
(https://git.ffmpeg.org/ffmpeg), e.g. by typing the command
@command{git log} in the FFmpeg source directory, or browsing the
online repository at @url{http://source.ffmpeg.org}.
online repository at @url{https://git.ffmpeg.org/ffmpeg}.
Maintainers for the specific components are listed in the file
@file{MAINTAINERS} in the source code tree.

View File

@ -81,7 +81,7 @@ Top-left position.
@end table
@item tick_rate
Set the tick rate (@emph{num_units_in_display_tick / time_scale}) in
Set the tick rate (@emph{time_scale / num_units_in_display_tick}) in
the timing info in the sequence header.
@item num_ticks_per_picture
Set the number of ticks in each picture, to indicate that the stream
@ -132,6 +132,36 @@ the header stored in extradata to the key packets:
ffmpeg -i INPUT -map 0 -flags:v +global_header -c:v libx264 -bsf:v dump_extra out.ts
@end example
@section dv_error_marker
Blocks in DV which are marked as damaged are replaced by blocks of the specified color.
@table @option
@item color
The color to replace damaged blocks by
@item sta
A 16 bit mask which specifies which of the 16 possible error status values are
to be replaced by colored blocks. 0xFFFE is the default which replaces all non 0
error status values.
@table @samp
@item ok
No error, no concealment
@item err
Error, No concealment
@item res
Reserved
@item notok
Error or concealment
@item notres
Not reserved
@item Aa, Ba, Ca, Ab, Bb, Cb, A, B, C, a, b, erri, erru
The specific error status code
@end table
see page 44-46 or section 5.5 of
@url{http://web.archive.org/web/20060927044735/http://www.smpte.org/smpte_store/standards/pdf/s314m.pdf}
@end table
@section eac3_core
Extract the core from a E-AC-3 stream, dropping extra channels.
@ -217,12 +247,16 @@ Modify metadata embedded in an H.264 stream.
Insert or remove AUD NAL units in all access units of the stream.
@table @samp
@item pass
@item insert
@item remove
@end table
Default is pass.
@item sample_aspect_ratio
Set the sample aspect ratio of the stream in the VUI parameters.
See H.264 table E-1.
@item overscan_appropriate_flag
Set whether the stream is suitable for display using overscan
@ -244,7 +278,7 @@ Set the chroma sample location in the stream (see H.264 section
E.2.1 and figure E-1).
@item tick_rate
Set the tick rate (num_units_in_tick / time_scale) in the VUI
Set the tick rate (time_scale / num_units_in_tick) in the VUI
parameters. This is the smallest time unit representable in the
stream, and in many cases represents the field rate of the stream
(double the frame rate).
@ -253,6 +287,11 @@ Set whether the stream has fixed framerate - typically this indicates
that the framerate is exactly half the tick rate, but the exact
meaning is dependent on interlacing and the picture structure (see
H.264 section E.2.1 and table E-6).
@item zero_new_constraint_set_flags
Zero constraint_set4_flag and constraint_set5_flag in the SPS. These
bits were reserved in a previous version of the H.264 spec, and thus
some hardware decoders require these to be zero. The result of zeroing
this is still a valid bitstream.
@item crop_left
@item crop_right
@ -276,6 +315,37 @@ insert the string ``hello'' associated with the given UUID.
@item delete_filler
Deletes both filler NAL units and filler SEI messages.
@item display_orientation
Insert, extract or remove Display orientation SEI messages.
See H.264 section D.1.27 and D.2.27 for syntax and semantics.
@table @samp
@item pass
@item insert
@item remove
@item extract
@end table
Default is pass.
Insert mode works in conjunction with @code{rotate} and @code{flip} options.
Any pre-existing Display orientation messages will be removed in insert or remove mode.
Extract mode attaches the display matrix to the packet as side data.
@item rotate
Set rotation in display orientation SEI (anticlockwise angle in degrees).
Range is -360 to +360. Default is NaN.
@item flip
Set flip in display orientation SEI.
@table @samp
@item horizontal
@item vertical
@end table
Default is unset.
@item level
Set the level in the SPS. Refer to H.264 section A.3 and tables A-1
to A-5.
@ -347,8 +417,8 @@ Set the chroma sample location in the stream (see H.265 section
E.3.1 and figure E.1).
@item tick_rate
Set the tick rate in the VPS and VUI parameters (num_units_in_tick /
time_scale). Combined with @option{num_ticks_poc_diff_one}, this can
Set the tick rate in the VPS and VUI parameters (time_scale /
num_units_in_tick). Combined with @option{num_ticks_poc_diff_one}, this can
set a constant framerate in the stream. Note that it is likely to be
overridden by container parameters when the stream is in a container.
@ -529,20 +599,67 @@ container. Can be used for fuzzing or testing error resilience/concealment.
Parameters:
@table @option
@item amount
A numeral string, whose value is related to how often output bytes will
be modified. Therefore, values below or equal to 0 are forbidden, and
the lower the more frequent bytes will be modified, with 1 meaning
every byte is modified.
Accepts an expression whose evaluation per-packet determines how often bytes in that
packet will be modified. A value below 0 will result in a variable frequency.
Default is 0 which results in no modification. However, if neither amount nor drop is specified,
amount will be set to @var{-1}. See below for accepted variables.
@item drop
Accepts an expression evaluated per-packet whose value determines whether that packet is dropped.
Evaluation to a positive value results in the packet being dropped. Evaluation to a negative
value results in a variable chance of it being dropped, roughly inverse in proportion to the magnitude
of the value. Default is 0 which results in no drops. See below for accepted variables.
@item dropamount
A numeral string, whose value is related to how often packets will be dropped.
Therefore, values below or equal to 0 are forbidden, and the lower the more
frequent packets will be dropped, with 1 meaning every packet is dropped.
Accepts a non-negative integer, which assigns a variable chance of it being dropped, roughly inverse
in proportion to the value. Default is 0 which results in no drops. This option is kept for backwards
compatibility and is equivalent to setting drop to a negative value with the same magnitude
i.e. @code{dropamount=4} is the same as @code{drop=-4}. Ignored if drop is also specified.
@end table
The following example applies the modification to every byte but does not drop
any packets.
Both @code{amount} and @code{drop} accept expressions containing the following variables:
@table @samp
@item n
The index of the packet, starting from zero.
@item tb
The timebase for packet timestamps.
@item pts
Packet presentation timestamp.
@item dts
Packet decoding timestamp.
@item nopts
Constant representing AV_NOPTS_VALUE.
@item startpts
First non-AV_NOPTS_VALUE PTS seen in the stream.
@item startdts
First non-AV_NOPTS_VALUE DTS seen in the stream.
@item duration
@itemx d
Packet duration, in timebase units.
@item pos
Packet position in input; may be -1 when unknown or not set.
@item size
Packet size, in bytes.
@item key
Whether packet is marked as a keyframe.
@item state
A pseudo random integer, primarily derived from the content of packet payload.
@end table
@subsection Examples
Apply modification to every byte but don't drop any packets.
@example
ffmpeg -i INPUT -c copy -bsf noise[=1] output.mkv
ffmpeg -i INPUT -c copy -bsf noise=1 output.mkv
@end example
Drop every video packet not marked as a keyframe after timestamp 30s but do not
modify any of the remaining packets.
@example
ffmpeg -i INPUT -c copy -bsf:v noise=drop='gt(t\,30)*not(key)' output.mkv
@end example
Drop one second of audio every 10 seconds and add some random noise to the rest.
@example
ffmpeg -i INPUT -c copy -bsf:a noise=amount=-1:drop='between(mod(t\,10)\,9\,10)' output.mkv
@end example
@section null
@ -578,6 +695,14 @@ for NTSC frame rate using the @option{frame_rate} option.
ffmpeg -f lavfi -i sine=r=48000:d=1 -c pcm_s16le -bsf pcm_rechunk=r=30000/1001 -f framecrc -
@end example
@section pgs_frame_merge
Merge a sequence of PGS Subtitle segments ending with an "end of display set"
segment into a single packet.
This is required by some containers that support PGS subtitles
(muxer @code{matroska}).
@section prores_metadata
Modify color property metadata embedded in prores stream.
@ -684,6 +809,10 @@ It accepts the following parameters:
@item pts
@item dts
Set expressions for PTS, DTS or both.
@item duration
Set expression for duration.
@item time_base
Set output time base.
@end table
The expressions are evaluated through the eval API and can contain the following
@ -707,6 +836,9 @@ The demux timestamp in input.
@item PTS
The presentation timestamp in input.
@item DURATION
The duration in input.
@item STARTDTS
The DTS of the first packet.
@ -719,17 +851,38 @@ The previous input DTS.
@item PREV_INPTS
The previous input PTS.
@item PREV_INDURATION
The previous input duration.
@item PREV_OUTDTS
The previous output DTS.
@item PREV_OUTPTS
The previous output PTS.
@item PREV_OUTDURATION
The previous output duration.
@item NEXT_DTS
The next input DTS.
@item NEXT_PTS
The next input PTS.
@item NEXT_DURATION
The next input duration.
@item TB
The timebase of stream packet belongs.
@item TB_OUT
The output timebase.
@item SR
The sample rate of stream packet belongs.
@item NOPTS
The AV_NOPTS_VALUE constant.
@end table
@anchor{text2movsub}

File diff suppressed because one or more lines are too long

View File

@ -144,21 +144,6 @@ Default value is 0.
@item b_qfactor @var{float} (@emph{encoding,video})
Set qp factor between P and B frames.
@item b_strategy @var{integer} (@emph{encoding,video})
Set strategy to choose between I/P/B-frames.
@item ps @var{integer} (@emph{encoding,video})
Set RTP payload size in bytes.
@item mv_bits @var{integer}
@item header_bits @var{integer}
@item i_tex_bits @var{integer}
@item p_tex_bits @var{integer}
@item i_count @var{integer}
@item p_count @var{integer}
@item skip_count @var{integer}
@item misc_bits @var{integer}
@item frame_bits @var{integer}
@item codec_tag @var{integer}
@item bug @var{flags} (@emph{decoding,video})
Workaround not auto detected encoder bugs.
@ -248,9 +233,6 @@ consider things that a sane encoder should not do as an error
@item block_align @var{integer}
@item mpeg_quant @var{integer} (@emph{encoding,video})
Use MPEG quantizers instead of H.263.
@item rc_override_count @var{integer}
@item maxrate @var{integer} (@emph{encoding,audio,video})
@ -356,19 +338,6 @@ favor predicting from the previous frame instead of the current
@item bits_per_coded_sample @var{integer}
@item pred @var{integer} (@emph{encoding,video})
Set prediction method.
Possible values:
@table @samp
@item left
@item plane
@item median
@end table
@item aspect @var{rational number} (@emph{encoding,video})
Set sample aspect ratio.
@ -585,9 +554,6 @@ sab diamond motion estimation
@item last_pred @var{integer} (@emph{encoding,video})
Set amount of motion predictors from the previous frame.
@item preme @var{integer} (@emph{encoding,video})
Set pre motion estimation.
@item precmp @var{integer} (@emph{encoding,video})
Set pre motion estimation compare function.
@ -636,23 +602,6 @@ Set limit motion vectors range (1023 for DivX player).
@item global_quality @var{integer} (@emph{encoding,audio,video})
@item coder @var{integer} (@emph{encoding,video})
Possible values:
@table @samp
@item vlc
variable length coder / huffman coder
@item ac
arithmetic coder
@item raw
raw (no encoding)
@item rle
run-length coder
@end table
@item context @var{integer} (@emph{encoding,video})
Set context model.
@item slice_flags @var{integer}
@item mbd @var{integer} (@emph{encoding,video})
@ -668,12 +617,6 @@ use fewest bits
use best rate distortion
@end table
@item sc_threshold @var{integer} (@emph{encoding,video})
Set scene change threshold.
@item nr @var{integer} (@emph{encoding,video})
Set noise reduction.
@item rc_init_occupancy @var{integer} (@emph{encoding,video})
Set number of bits which should be loaded into the rc buffer before
decoding starts.
@ -761,64 +704,12 @@ Possible values:
@item lowres @var{integer} (@emph{decoding,audio,video})
Decode at 1= 1/2, 2=1/4, 3=1/8 resolutions.
@item skip_threshold @var{integer} (@emph{encoding,video})
Set frame skip threshold.
@item skip_factor @var{integer} (@emph{encoding,video})
Set frame skip factor.
@item skip_exp @var{integer} (@emph{encoding,video})
Set frame skip exponent.
Negative values behave identical to the corresponding positive ones, except
that the score is normalized.
Positive values exist primarily for compatibility reasons and are not so useful.
@item skipcmp @var{integer} (@emph{encoding,video})
Set frame skip compare function.
Possible values:
@table @samp
@item sad
sum of absolute differences, fast (default)
@item sse
sum of squared errors
@item satd
sum of absolute Hadamard transformed differences
@item dct
sum of absolute DCT transformed differences
@item psnr
sum of squared quantization errors (avoid, low quality)
@item bit
number of bits needed for the block
@item rd
rate distortion optimal, slow
@item zero
0
@item vsad
sum of absolute vertical differences
@item vsse
sum of squared vertical differences
@item nsse
noise preserving sum of squared differences
@item w53
5/3 wavelet, only used in snow
@item w97
9/7 wavelet, only used in snow
@item dctmax
@item chroma
@end table
@item mblmin @var{integer} (@emph{encoding,video})
Set min macroblock lagrange factor (VBR).
@item mblmax @var{integer} (@emph{encoding,video})
Set max macroblock lagrange factor (VBR).
@item mepc @var{integer} (@emph{encoding,video})
Set motion estimation bitrate penalty compensation (1.0 = 256).
@item skip_loop_filter @var{integer} (@emph{decoding,video})
@item skip_idct @var{integer} (@emph{decoding,video})
@item skip_frame @var{integer} (@emph{decoding,video})
@ -858,31 +749,17 @@ Default value is @samp{default}.
@item bidir_refine @var{integer} (@emph{encoding,video})
Refine the two motion vectors used in bidirectional macroblocks.
@item brd_scale @var{integer} (@emph{encoding,video})
Downscale frames for dynamic B-frame decision.
@item keyint_min @var{integer} (@emph{encoding,video})
Set minimum interval between IDR-frames.
@item refs @var{integer} (@emph{encoding,video})
Set reference frames to consider for motion compensation.
@item chromaoffset @var{integer} (@emph{encoding,video})
Set chroma qp offset from luma.
@item trellis @var{integer} (@emph{encoding,audio,video})
Set rate-distortion optimal quantization.
@item mv0_threshold @var{integer} (@emph{encoding,video})
@item b_sensitivity @var{integer} (@emph{encoding,video})
Adjust sensitivity of b_frame_strategy 1.
@item compression_level @var{integer} (@emph{encoding,audio,video})
@item min_prediction_order @var{integer} (@emph{encoding,audio})
@item max_prediction_order @var{integer} (@emph{encoding,audio})
@item timecode_frame_start @var{integer} (@emph{encoding,video})
Set GOP timecode frame start number, in non drop frame format.
@item bits_per_raw_sample @var{integer}
@item channel_layout @var{integer} (@emph{decoding/encoding,audio})

View File

@ -76,13 +76,19 @@ The following options are supported by the libdav1d wrapper.
@item framethreads
Set amount of frame threads to use during decoding. The default value is 0 (autodetect).
This option is deprecated for libdav1d >= 1.0 and will be removed in the future. Use the
global option @code{threads} instead.
@item tilethreads
Set amount of tile threads to use during decoding. The default value is 0 (autodetect).
This option is deprecated for libdav1d >= 1.0 and will be removed in the future. Use the
global option @code{threads} instead.
@item filmgrain
Apply film grain to the decoded video if present in the bitstream. Defaults to the
internal default of the library.
This option is deprecated and will be removed in the future. See the global option
@code{export_side_data} to export Film Grain parameters instead of applying it.
@item oppoint
Select an operating point of a scalable AV1 bitstream (0 - 31). Defaults to the
@ -120,6 +126,63 @@ Set amount of frame threads to use during decoding. The default value is 0 (auto
@end table
@section QSV Decoders
The family of Intel QuickSync Video decoders (VC1, MPEG-2, H.264, HEVC,
JPEG/MJPEG, VP8, VP9, AV1).
@subsection Common Options
The following options are supported by all qsv decoders.
@table @option
@item @var{async_depth}
Internal parallelization depth, the higher the value the higher the latency.
@item @var{gpu_copy}
A GPU-accelerated copy between video and system memory
@table @samp
@item default
@item on
@item off
@end table
@end table
@subsection HEVC Options
Extra options for hevc_qsv.
@table @option
@item @var{load_plugin}
A user plugin to load in an internal session
@table @samp
@item none
@item hevc_sw
@item hevc_hw
@end table
@item @var{load_plugins}
A :-separate list of hexadecimal plugin UIDs to load in an internal session
@end table
@section v210
Uncompressed 4:2:2 10-bit decoder.
@subsection Options
@table @option
@item custom_stride
Set the line size of the v210 data in bytes. The default value is 0
(autodetect). You can use the special -1 value for a strideless v210 as seen in
BOXX files.
@end table
@c man end VIDEO DECODERS
@chapter Audio Decoders
@ -293,6 +356,8 @@ Enabled by default.
@table @option
@item compute_clut
@table @option
@item -2
Compute clut once if no matching CLUT is in the stream.
@item -1
Compute clut if no matching CLUT is in the stream.
@item 0

View File

@ -25,6 +25,13 @@ Audible Format 2, 3, and 4 demuxer.
This demuxer is used to demux Audible Format 2, 3, and 4 (.aa) files.
@section aac
Raw Audio Data Transport Stream AAC demuxer.
This demuxer is used to demux an ADTS input containing a single AAC stream
alongwith any ID3v1/2 or APE tags in it.
@section apng
Animated Portable Network Graphics demuxer.
@ -37,12 +44,15 @@ between the last fcTL and IEND chunks.
@table @option
@item -ignore_loop @var{bool}
Ignore the loop variable in the file if set.
Ignore the loop variable in the file if set. Default is enabled.
@item -max_fps @var{int}
Maximum framerate in frames per second (0 for no limit).
Maximum framerate in frames per second. Default of 0 imposes no limit.
@item -default_fps @var{int}
Default framerate in frames per second when none is specified in the file
(0 meaning as fast as possible).
(0 meaning as fast as possible). Default is 15.
@end table
@section asf
@ -93,8 +103,7 @@ backslash or single quotes.
All subsequent file-related directives apply to that file.
@item @code{ffconcat version 1.0}
Identify the script type and version. It also sets the @option{safe} option
to 1 if it was -1.
Identify the script type and version.
To make FFmpeg recognize the format automatically, this directive must
appear exactly as is (no extra space or byte-order-mark) on the very first
@ -148,6 +157,16 @@ directive) will be reduced based on their specified Out point.
Metadata of the packets of the file. The specified metadata will be set for
each file packet. You can specify this directive multiple times to add multiple
metadata entries.
This directive is deprecated, use @code{file_packet_meta} instead.
@item @code{file_packet_meta @var{key} @var{value}}
Metadata of the packets of the file. The specified metadata will be set for
each file packet. You can specify this directive multiple times to add multiple
metadata entries.
@item @code{option @var{key} @var{value}}
Option to access, open and probe the file.
Can be present multiple times.
@item @code{stream}
Introduce a stream in the virtual file.
@ -165,6 +184,20 @@ subfiles will be used.
This is especially useful for MPEG-PS (VOB) files, where the order of the
streams is not reliable.
@item @code{stream_meta @var{key} @var{value}}
Metadata for the stream.
Can be present multiple times.
@item @code{stream_codec @var{value}}
Codec for the stream.
@item @code{stream_extradata @var{hex_string}}
Extradata for the string, encoded in hexadecimal.
@item @code{chapter @var{id} @var{start} @var{end}}
Add a chapter. @var{id} is an unique identifier, possibly small and
consecutive.
@end table
@subsection Options
@ -174,7 +207,8 @@ This demuxer accepts the following option:
@table @option
@item safe
If set to 1, reject unsafe file paths. A file path is considered safe if it
If set to 1, reject unsafe file paths and directives.
A file path is considered safe if it
does not contain a protocol specification and is relative and all components
only contain characters from the portable character set (letters, digits,
period, underscore and hyphen) and have no period at the beginning of a
@ -184,9 +218,6 @@ If set to 0, any file name is accepted.
The default is 1.
-1 is equivalent to 1 if the format was automatically
probed and 0 otherwise.
@item auto_convert
If set to 1, try to perform automatic conversions on packet data to make the
streams concatenable.
@ -243,11 +274,29 @@ which streams to actually receive.
Each stream mirrors the @code{id} and @code{bandwidth} properties from the
@code{<Representation>} as metadata keys named "id" and "variant_bitrate" respectively.
@section flv, live_flv
@subsection Options
This demuxer accepts the following option:
@table @option
@item cenc_decryption_key
16-byte key, in hex, to decrypt files encrypted using ISO Common Encryption (CENC/AES-128 CTR; ISO/IEC 23001-7).
@end table
@section imf
Interoperable Master Format demuxer.
This demuxer presents audio and video streams found in an IMF Composition.
@section flv, live_flv, kux
Adobe Flash Video Format demuxer.
This demuxer is used to demux FLV files and RTMP network streams. In case of live network streams, if you force format, you may use live_flv option instead of flv to survive timestamp discontinuities.
KUX is a flv variant used on the Youku platform.
@example
ffmpeg -f flv -i myfile.flv ...
@ -324,6 +373,9 @@ It accepts the following options:
@item live_start_index
segment index to start live streams at (negative values are from the end).
@item prefer_x_start
prefer to use #EXT-X-START if it's in playlist instead of live_start_index.
@item allowed_extensions
',' separated list of file extensions that hls is allowed to access.
@ -346,6 +398,9 @@ Enabled by default for HTTP/1.1 servers.
@item http_seekable
Use HTTP partial requests for downloading HTTP segments.
0 = disable, 1 = enable, -1 = auto, Default is auto.
@item seg_format_options
Set options for the demuxer of media segments using a list of key=value pairs separated by @code{:}.
@end table
@section image2
@ -661,6 +716,12 @@ Set mfra timestamps as PTS
Don't use mfra box to set timestamps
@end table
@item use_tfdt
For fragmented input, set fragment's starting timestamp to @code{baseMediaDecodeTime} from the @code{tfdt} box.
Default is enabled, which will prefer to use the @code{tfdt} box to set DTS. Disable to use the @code{earliest_presentation_time} from the @code{sidx} box.
In either case, the timestamp from the @code{mfra} box will be used if it's available and @code{use_mfra_for} is
set to pts or dts.
@item export_all
Export unrecognized boxes within the @var{udta} box as metadata entries. The first four
characters of the box type are set as the key. Default is false.
@ -679,6 +740,15 @@ specify.
@item decryption_key
16-byte key, in hex, to decrypt files encrypted using ISO Common Encryption (CENC/AES-128 CTR; ISO/IEC 23001-7).
@item max_stts_delta
Very high sample deltas written in a trak's stts box may occasionally be intended but usually they are written in
error or used to store a negative value for dts correction when treated as signed 32-bit integers. This option lets
the user set an upper limit, beyond which the delta is clamped to 1. Values greater than the limit if negative when
cast to int32 are used to adjust onward dts.
Unit is the track time scale. Range is 0 to UINT_MAX. Default is @code{UINT_MAX - 48000*10} which allows upto
a 10 second dts correction for 48 kHz audio streams while accommodating 99.9% of @code{uint32} range.
@end table
@subsection Audible AAX
@ -719,6 +789,10 @@ disabled). Default value is -1.
@item merge_pmt_versions
Re-use existing streams when a PMT's version is updated and elementary
streams move to different PIDs. Default value is 0.
@item max_packet_size
Set maximum size, in bytes, of packet emitted by the demuxer. Payloads above this size
are split across multiple packets. Range is 1 to INT_MAX/2. Default is 204800 bytes.
@end table
@section mpjpeg

View File

@ -494,6 +494,22 @@ patch is inline or attached per mail.
You can check @url{https://patchwork.ffmpeg.org}, if your patch does not show up, its mime type
likely was wrong.
@subheading Sending patches from email clients
Using @code{git send-email} might not be desirable for everyone. The
following trick allows to send patches via email clients in a safe
way. It has been tested with Outlook and Thunderbird (with X-Unsent
extension) and might work with other applications.
Create your patch like this:
@verbatim
git format-patch -s -o "outputfolder" --add-header "X-Unsent: 1" --suffix .eml --to ffmpeg-devel@ffmpeg.org -1 1a2b3c4d
@end verbatim
Now you'll just need to open the eml file with the email application
and execute 'Send'.
@subheading Reviews
Your patch will be reviewed on the mailing list. You will likely be asked
to make some changes and are expected to send in an improved version that
incorporates the requests from the review. This process may go through

View File

@ -1,10 +1,13 @@
#!/bin/sh
OUT_DIR="${1}"
DOXYFILE="${2}"
DOXYGEN="${3}"
SRC_DIR="${2}"
DOXYFILE="${3}"
DOXYGEN="${4}"
shift 3
shift 4
cd ${SRC_DIR}
if [ -e "VERSION" ]; then
VERSION=`cat "VERSION"`

View File

@ -53,7 +53,7 @@ Set AAC encoder coding method. Possible values:
@table @samp
@item twoloop
Two loop searching (TLS) method.
Two loop searching (TLS) method. This is the default method.
This method first sets quantizers depending on band thresholds and then tries
to find an optimal combination by adding or subtracting a specific value from
@ -75,7 +75,6 @@ Constant quantizer method.
Uses a cheaper version of twoloop algorithm that doesn't try to do as many
clever adjustments. Worse with low bitrates (less than 64kbps), but is better
and much faster at higher bitrates.
This is the default choice for a coder
@end table
@ -1268,6 +1267,59 @@ disabled
A description of some of the currently available video encoders
follows.
@section a64_multi, a64_multi5
A64 / Commodore 64 multicolor charset encoder. @code{a64_multi5} is extended with 5th color (colram).
@section Cinepak
Cinepak aka CVID encoder.
Compatible with Windows 3.1 and vintage MacOS.
@subsection Options
@table @option
@item g @var{integer}
Keyframe interval.
A keyframe is inserted at least every @code{-g} frames, sometimes sooner.
@item q:v @var{integer}
Quality factor. Lower is better. Higher gives lower bitrate.
The following table lists bitrates when encoding akiyo_cif.y4m for various values of @code{-q:v} with @code{-g 100}:
@table @option
@item @code{-q:v 1} 1918 kb/s
@item @code{-q:v 2} 1735 kb/s
@item @code{-q:v 4} 1500 kb/s
@item @code{-q:v 10} 1041 kb/s
@item @code{-q:v 20} 826 kb/s
@item @code{-q:v 40} 553 kb/s
@item @code{-q:v 100} 394 kb/s
@item @code{-q:v 200} 312 kb/s
@item @code{-q:v 400} 266 kb/s
@item @code{-q:v 1000} 237 kb/s
@end table
@item max_extra_cb_iterations @var{integer}
Max extra codebook recalculation passes, more is better and slower.
@item skip_empty_cb @var{boolean}
Avoid wasting bytes, ignore vintage MacOS decoder.
@item max_strips @var{integer}
@itemx min_strips @var{integer}
The minimum and maximum number of strips to use.
Wider range sometimes improves quality.
More strips is generally better quality but costs more bits.
Fewer strips tend to yield more keyframes.
Vintage compatible is 1..3.
@item strip_number_adaptivity @var{integer}
How much number of strips is allowed to change between frames.
Higher is better but slower.
@end table
@section GIF
GIF image/animation encoder.
@ -1747,27 +1799,29 @@ You need to explicitly configure the build with @code{--enable-libsvtav1}.
@table @option
@item profile
Set the encoding profile.
@table @samp
@item main
@item high
@item professional
@end table
@item level
Set the operating point level.
Set the operating point level. For example: '4.0'
@item hielevel
Set the Hierarchical prediction levels.
@table @samp
@item 3level
@item 4level
This is the default.
@end table
@item tier
Set the operating point tier.
@item rc
Set the rate control mode to use.
Possible modes:
@table @option
@item cqp
Constant quantizer: use fixed values of qindex (dependent on the frame type)
throughout the stream. This mode is the default.
@item vbr
Variable bitrate: use a target bitrate for the whole stream.
@item cvbr
Constrained variable bitrate: use a target bitrate for each GOP.
@table @samp
@item main
This is the default.
@item high
@end table
@item qmax
@ -1776,6 +1830,9 @@ Set the maximum quantizer to use when using a bitrate mode.
@item qmin
Set the minimum quantizer to use when using a bitrate mode.
@item crf
Constant rate factor value used in crf rate control mode (0-63).
@item qp
Set the quantizer used in cqp rate control mode (0-63).
@ -1786,8 +1843,8 @@ Enable scene change detection.
Set number of frames to look ahead (0-120).
@item preset
Set the quality-speed tradeoff, in the range 0 to 8. Higher values are
faster but lower quality. Defaults to 8 (highest speed).
Set the quality-speed tradeoff, in the range 0 to 13. Higher values are
faster but lower quality.
@item tile_rows
Set log2 of the number of rows of tiles to use (0-6).
@ -1795,6 +1852,45 @@ Set log2 of the number of rows of tiles to use (0-6).
@item tile_columns
Set log2 of the number of columns of tiles to use (0-4).
@item svtav1-params
Set SVT-AV1 options using a list of @var{key}=@var{value} pairs separated
by ":". See the SVT-AV1 encoder user guide for a list of accepted parameters.
@end table
@section libjxl
libjxl JPEG XL encoder wrapper.
Requires the presence of the libjxl headers and library during
configuration. You need to explicitly configure the build with
@code{--enable-libjxl}.
@subsection Options
The libjxl wrapper supports the following options:
@table @option
@item distance
Set the target Butteraugli distance. This is a quality setting: lower
distance yields higher quality, with distance=1.0 roughly comparable to
libjpeg Quality 90 for photographic content. Setting distance=0.0 yields
true lossless encoding. Valid values range between 0.0 and 15.0, and sane
values rarely exceed 5.0. Setting distance=0.1 usually attains
transparency for most input. The default is 1.0.
@item effort
Set the encoding effort used. Higher effort values produce more consistent
quality and usually produces a better quality/bpp curve, at the cost of
more CPU time required. Valid values range from 1 to 9, and the default is 7.
@item modular
Force the encoder to use Modular mode instead of choosing automatically. The
default is to use VarDCT for lossy encoding and Modular for lossless. VarDCT
is generally superior to Modular for lossy encoding but does not support
lossless encoding.
@end table
@section libkvazaar
@ -1984,8 +2080,11 @@ kilobits/s.
@item keyint_min (@emph{kf-min-dist})
@item qmin (@emph{min-q})
Minimum (Best Quality) Quantizer.
@item qmax (@emph{max-q})
Maximum (Worst Quality) Quantizer.
Can be changed per-frame.
@item bufsize (@emph{buf-sz}, @emph{buf-optimal-sz})
Set ratecontrol buffer size (in bits). Note @command{vpxenc}'s options are
@ -2249,11 +2348,10 @@ and compression tools used, and varies the combination of these tools. This
maps to the @var{method} option in libwebp. The valid range is 0 to 6.
Default is 4.
@item -qscale @var{float}
For lossy encoding, this controls image quality, 0 to 100. For lossless
encoding, this controls the effort and time spent at compressing more. The
default value is 75. Note that for usage via libavcodec, this option is called
@var{global_quality} and must be multiplied by @var{FF_QP2LAMBDA}.
@item -quality @var{float}
For lossy encoding, this controls image quality. For lossless encoding, this
controls the effort and time spent in compression.
Range is 0 to 100. Default is 75.
@item -preset @var{type}
Configuration preset. This does some automatic settings based on the general
@ -2639,6 +2737,9 @@ ffmpeg -i foo.mpg -c:v libx264 -x264opts keyint=123:min-keyint=20 -an out.mkv
Import closed captions (which must be ATSC compatible format) into output.
Only the mpeg2 and h264 decoders provide these. Default is 1 (on).
@item udu_sei @var{boolean}
Import user data unregistered SEI if available into output. Default is 0 (off).
@item x264-params (N.A.)
Override the x264 configuration using a :-separated list of key=value
parameters.
@ -2720,6 +2821,9 @@ Quantizer curve compression factor
Normally, when forcing a I-frame type, the encoder can select any type
of I-frame. This option forces it to choose an IDR-frame.
@item udu_sei @var{boolean}
Import user data unregistered SEI if available into output. Default is 0 (off).
@item x265-params
Set x265 options using a list of @var{key}=@var{value} couples separated
by ":". See @command{x265 --help} for a list of options.
@ -3096,12 +3200,13 @@ Setting a higher @option{bits_per_mb} limit will improve the speed.
For the fastest encoding speed set the @option{qscale} parameter (4 is the
recommended value) and do not set a size constraint.
@section QSV encoders
@section QSV Encoders
The family of Intel QuickSync Video encoders (MPEG-2, H.264, HEVC, JPEG/MJPEG and VP9)
The family of Intel QuickSync Video encoders (MPEG-2, H.264, HEVC, JPEG/MJPEG
and VP9)
@subsection Ratecontrol Method
The ratecontrol method is selected as follows:
@itemize @bullet
@item
When @option{global_quality} is specified, a quality-based mode is used.
@ -3116,7 +3221,8 @@ also set (the @option{-qscale} ffmpeg option).
@option{look_ahead} option is also set.
@item
@var{ICQ} -- intelligent constant quality otherwise.
@var{ICQ} -- intelligent constant quality otherwise. For the ICQ modes, global
quality range is 1 to 51, with 1 being the best quality.
@end itemize
@item
@ -3148,6 +3254,7 @@ Note that depending on your system, a different mode than the one you specified
may be selected by the encoder. Set the verbosity level to @var{verbose} or
higher to see the actual settings used by the QSV runtime.
@subsection Global Options -> MSDK Options
Additional libavcodec global options are mapped to MSDK options as follows:
@itemize
@ -3184,6 +3291,389 @@ encoder use CAVLC instead of CABAC.
@end itemize
@subsection Common Options
Following options are used by all qsv encoders.
@table @option
@item @var{async_depth}
Specifies how many asynchronous operations an application performs
before the application explicitly synchronizes the result. If zero,
the value is not specified.
@item @var{avbr_accuracy}
Accuracy of the AVBR ratecontrol (unit of tenth of percent).
@item @var{avbr_convergence}
Convergence of the AVBR ratecontrol (unit of 100 frames)
The parameters @var{avbr_accuracy} and @var{avbr_convergence} are for the
average variable bitrate control (AVBR) algorithm.
The algorithm focuses on overall encoding quality while meeting the specified
bitrate, @var{target_bitrate}, within the accuracy range @var{avbr_accuracy},
after a @var{avbr_Convergence} period. This method does not follow HRD and the
instant bitrate is not capped or padded.
@item @var{preset}
This option itemizes a range of choices from veryfast (best speed) to veryslow
(best quality).
@table @samp
@item veryfast
@item faster
@item fast
@item medium
@item slow
@item slower
@item veryslow
@end table
@item @var{forced_idr}
Forcing I frames as IDR frames.
@item @var{low_power}
For encoders set this flag to ON to reduce power consumption and GPU usage.
@end table
@subsection Runtime Options
Following options can be used durning qsv encoding.
@table @option
@item @var{qsv_config_qp}
Supported in h264_qsv and hevc_qsv.
This option can be set in per-frame metadata. QP parameter can be dynamically
changed when encoding in CQP mode.
@end table
@subsection H264 options
These options are used by h264_qsv
@table @option
@item @var{extbrc}
Extended bitrate control.
@item @var{recovery_point_sei}
Set this flag to insert the recovery point SEI message at the beginning of every
intra refresh cycle.
@item @var{rdo}
Enable rate distortion optimization.
@item @var{max_frame_size}
Maximum encoded frame size in bytes.
@item @var{max_frame_size_i}
Maximum encoded frame size for I frames in bytes. If this value is set as larger
than zero, then for I frames the value set by max_frame_size is ignored.
@item @var{max_frame_size_p}
Maximum encoded frame size for P frames in bytes. If this value is set as larger
than zero, then for P frames the value set by max_frame_size is ignored.
@item @var{max_slice_size}
Maximum encoded slice size in bytes.
@item @var{bitrate_limit}
Toggle bitrate limitations.
Modifies bitrate to be in the range imposed by the QSV encoder. Setting this
flag off may lead to violation of HRD conformance. Mind that specifying bitrate
below the QSV encoder range might significantly affect quality. If on this
option takes effect in non CQP modes: if bitrate is not in the range imposed
by the QSV encoder, it will be changed to be in the range.
@item @var{mbbrc}
Setting this flag enables macroblock level bitrate control that generally
improves subjective visual quality. Enabling this flag may have negative impact
on performance and objective visual quality metric.
@item @var{low_delay_brc}
Setting this flag turns on or off LowDelayBRC feautre in qsv plugin, which provides
more accurate bitrate control to minimize the variance of bitstream size frame
by frame. Value: -1-default 0-off 1-on
@item @var{adaptive_i}
This flag controls insertion of I frames by the QSV encoder. Turn ON this flag
to allow changing of frame type from P and B to I.
@item @var{adaptive_b}
This flag controls changing of frame type from B to P.
@item @var{p_strategy}
Enable P-pyramid: 0-default 1-simple 2-pyramid(bf need to be set to 0).
@item @var{b_strategy}
This option controls usage of B frames as reference.
@item @var{dblk_idc}
This option disable deblocking. It has value in range 0~2.
@item @var{cavlc}
If set, CAVLC is used; if unset, CABAC is used for encoding.
@item @var{vcm}
Video conferencing mode, please see ratecontrol method.
@item @var{idr_interval}
Distance (in I-frames) between IDR frames.
@item @var{pic_timing_sei}
Insert picture timing SEI with pic_struct_syntax element.
@item @var{single_sei_nal_unit}
Put all the SEI messages into one NALU.
@item @var{max_dec_frame_buffering}
Maximum number of frames buffered in the DPB.
@item @var{look_ahead}
Use VBR algorithm with look ahead.
@item @var{look_ahead_depth}
Depth of look ahead in number frames.
@item @var{look_ahead_downsampling}
Downscaling factor for the frames saved for the lookahead analysis.
@table @samp
@item unknown
@item auto
@item off
@item 2x
@item 4x
@end table
@item @var{int_ref_type}
Specifies intra refresh type. The major goal of intra refresh is improvement of
error resilience without significant impact on encoded bitstream size caused by
I frames. The SDK encoder achieves this by encoding part of each frame in
refresh cycle using intra MBs. @var{none} means no refresh. @var{vertical} means
vertical refresh, by column of MBs. To enable intra refresh, B frame should be
set to 0.
@item @var{int_ref_cycle_size}
Specifies number of pictures within refresh cycle starting from 2. 0 and 1 are
invalid values.
@item @var{int_ref_qp_delta}
Specifies QP difference for inserted intra MBs. This is signed value in
[-51, 51] range if target encoding bit-depth for luma samples is 8 and this
range is [-63, 63] for 10 bit-depth or [-75, 75] for 12 bit-depth respectively.
@item @var{int_ref_cycle_dist}
Distance between the beginnings of the intra-refresh cycles in frames.
@item @var{profile}
@table @samp
@item unknown
@item baseline
@item main
@item high
@end table
@item @var{a53cc}
Use A53 Closed Captions (if available).
@item @var{aud}
Insert the Access Unit Delimiter NAL.
@item @var{mfmode}
Multi-Frame Mode.
@table @samp
@item off
@item auto
@end table
@item @var{repeat_pps}
Repeat pps for every frame.
@item @var{max_qp_i}
Maximum video quantizer scale for I frame.
@item @var{min_qp_i}
Minimum video quantizer scale for I frame.
@item @var{max_qp_p}
Maximum video quantizer scale for P frame.
@item @var{min_qp_p}
Minimum video quantizer scale for P frame.
@item @var{max_qp_b}
Maximum video quantizer scale for B frame.
@item @var{min_qp_b}
Minimum video quantizer scale for B frame.
@end table
@subsection HEVC Options
These options are used by hevc_qsv
@table @option
@item @var{extbrc}
Extended bitrate control.
@item @var{recovery_point_sei}
Set this flag to insert the recovery point SEI message at the beginning of every
intra refresh cycle.
@item @var{rdo}
Enable rate distortion optimization.
@item @var{max_frame_size}
Maximum encoded frame size in bytes.
@item @var{max_frame_size_i}
Maximum encoded frame size for I frames in bytes. If this value is set as larger
than zero, then for I frames the value set by max_frame_size is ignored.
@item @var{max_frame_size_p}
Maximum encoded frame size for P frames in bytes. If this value is set as larger
than zero, then for P frames the value set by max_frame_size is ignored.
@item @var{max_slice_size}
Maximum encoded slice size in bytes.
@item @var{mbbrc}
Setting this flag enables macroblock level bitrate control that generally
improves subjective visual quality. Enabling this flag may have negative impact
on performance and objective visual quality metric.
@item @var{low_delay_brc}
Setting this flag turns on or off LowDelayBRC feautre in qsv plugin, which provides
more accurate bitrate control to minimize the variance of bitstream size frame
by frame. Value: -1-default 0-off 1-on
@item @var{p_strategy}
Enable P-pyramid: 0-default 1-simple 2-pyramid(bf need to be set to 0).
@item @var{b_strategy}
This option controls usage of B frames as reference.
@item @var{dblk_idc}
This option disable deblocking. It has value in range 0~2.
@item @var{idr_interval}
Distance (in I-frames) between IDR frames.
@table @samp
@item begin_only
Output an IDR-frame only at the beginning of the stream.
@end table
@item @var{load_plugin}
A user plugin to load in an internal session.
@table @samp
@item none
@item hevc_sw
@item hevc_hw
@end table
@item @var{load_plugins}
A :-separate list of hexadecimal plugin UIDs to load in
an internal session.
@item @var{look_ahead_depth}
Depth of look ahead in number frames, available when extbrc option is enabled.
@item @var{profile}
Set the encoding profile (scc requires libmfx >= 1.32).
@table @samp
@item unknown
@item main
@item main10
@item mainsp
@item rext
@item scc
@end table
@item @var{gpb}
1: GPB (generalized P/B frame)
0: regular P frame.
@item @var{tile_cols}
Number of columns for tiled encoding.
@item @var{tile_rows}
Number of rows for tiled encoding.
@item @var{aud}
Insert the Access Unit Delimiter NAL.
@item @var{pic_timing_sei}
Insert picture timing SEI with pic_struct_syntax element.
@item @var{transform_skip}
Turn this option ON to enable transformskip. It is supported on platform equal
or newer than ICL.
@item @var{int_ref_type}
Specifies intra refresh type. The major goal of intra refresh is improvement of
error resilience without significant impact on encoded bitstream size caused by
I frames. The SDK encoder achieves this by encoding part of each frame in
refresh cycle using intra MBs. @var{none} means no refresh. @var{vertical} means
vertical refresh, by column of MBs. To enable intra refresh, B frame should be
set to 0.
@item @var{int_ref_cycle_size}
Specifies number of pictures within refresh cycle starting from 2. 0 and 1 are
invalid values.
@item @var{int_ref_qp_delta}
Specifies QP difference for inserted intra MBs. This is signed value in
[-51, 51] range if target encoding bit-depth for luma samples is 8 and this
range is [-63, 63] for 10 bit-depth or [-75, 75] for 12 bit-depth respectively.
@item @var{int_ref_cycle_dist}
Distance between the beginnings of the intra-refresh cycles in frames.
@item @var{max_qp_i}
Maximum video quantizer scale for I frame.
@item @var{min_qp_i}
Minimum video quantizer scale for I frame.
@item @var{max_qp_p}
Maximum video quantizer scale for P frame.
@item @var{min_qp_p}
Minimum video quantizer scale for P frame.
@item @var{max_qp_b}
Maximum video quantizer scale for B frame.
@item @var{min_qp_b}
Minimum video quantizer scale for B frame.
@end table
@subsection MPEG2 Options
These options are used by mpeg2_qsv
@table @option
@item @var{profile}
@table @samp
@item unknown
@item simple
@item main
@item high
@end table
@end table
@subsection VP9 Options
These options are used by vp9_qsv
@table @option
@item @var{profile}
@table @samp
@item unknown
@item profile0
@item profile1
@item profile2
@item profile3
@end table
@item @var{tile_cols}
Number of columns for tiled encoding (requires libmfx >= 1.29).
@item @var{tile_rows}
Number of rows for tiled encoding (requires libmfx >= 1.29).
@end table
@section snow
@subsection Options
@ -3264,6 +3754,17 @@ will refer only to P- or I-frames. When set to greater values multiple layers
of B-frames will be present, frames in each layer only referring to frames in
higher layers.
@item async_depth
Maximum processing parallelism. Increase this to improve single channel
performance. This option doesn't work if driver doesn't implement vaSyncBuffer
function. Please make sure there are enough hw_frames allocated if a large
number of async_depth is used.
@item max_frame_size
Set the allowed max size in bytes for each frame. If the frame size exceeds
the limitation, encoder will adjust the QP value to control the frame size.
Invalid in CQP rate control mode.
@item rc_mode
Set the rate control mode to use. A given driver may only support a subset of
modes.
@ -3407,6 +3908,22 @@ required to produce a stream usable with all decoders.
@end table
@section vbn
Vizrt Binary Image encoder.
This format is used by the broadcast vendor Vizrt for quick texture streaming.
Advanced features of the format such as LZW compression of texture data or
generation of mipmaps are not supported.
@subsection Options
@table @option
@item format @var{string}
Sets the texture compression used by the VBN file. Can be @var{dxt1},
@var{dxt5} or @var{raw}. Default is @var{dxt5}.
@end table
@section vc2
SMPTE VC-2 (previously BBC Dirac Pro). This codec was primarily aimed at

View File

@ -97,7 +97,7 @@ static void decode(AVCodecContext *dec_ctx, AVPacket *pkt, AVFrame *frame,
exit(1);
}
for (i = 0; i < frame->nb_samples; i++)
for (ch = 0; ch < dec_ctx->channels; ch++)
for (ch = 0; ch < dec_ctx->ch_layout.nb_channels; ch++)
fwrite(frame->data[ch] + data_size*i, 1, data_size, outfile);
}
}
@ -215,7 +215,7 @@ int main(int argc, char **argv)
sfmt = av_get_packed_sample_fmt(sfmt);
}
n_channels = c->channels;
n_channels = c->ch_layout.nb_channels;
if ((ret = get_format_from_sample_fmt(&fmt, sfmt)) < 0)
goto end;

View File

@ -92,6 +92,7 @@ int main(int argc, char **argv)
uint8_t *data;
size_t data_size;
int ret;
int eof;
AVPacket *pkt;
if (argc <= 2) {
@ -150,15 +151,16 @@ int main(int argc, char **argv)
exit(1);
}
while (!feof(f)) {
do {
/* read raw data from the input file */
data_size = fread(inbuf, 1, INBUF_SIZE, f);
if (!data_size)
if (ferror(f))
break;
eof = !data_size;
/* use the parser to split the data into frames */
data = inbuf;
while (data_size > 0) {
while (data_size > 0 || eof) {
ret = av_parser_parse2(parser, c, &pkt->data, &pkt->size,
data, data_size, AV_NOPTS_VALUE, AV_NOPTS_VALUE, 0);
if (ret < 0) {
@ -170,8 +172,10 @@ int main(int argc, char **argv)
if (pkt->size)
decode(c, frame, pkt, outfilename);
else if (eof)
break;
}
}
} while (!eof);
/* flush the decoder */
decode(c, frame, NULL, outfilename);

View File

@ -32,6 +32,7 @@
#include <libavutil/imgutils.h>
#include <libavutil/samplefmt.h>
#include <libavutil/timestamp.h>
#include <libavcodec/avcodec.h>
#include <libavformat/avformat.h>
static AVFormatContext *fmt_ctx = NULL;
@ -149,8 +150,7 @@ static int open_codec_context(int *stream_idx,
{
int ret, stream_index;
AVStream *st;
AVCodec *dec = NULL;
AVDictionary *opts = NULL;
const AVCodec *dec = NULL;
ret = av_find_best_stream(fmt_ctx, type, -1, -1, NULL, 0);
if (ret < 0) {
@ -185,7 +185,7 @@ static int open_codec_context(int *stream_idx,
}
/* Init the decoders */
if ((ret = avcodec_open2(*dec_ctx, dec, &opts)) < 0) {
if ((ret = avcodec_open2(*dec_ctx, dec, NULL)) < 0) {
fprintf(stderr, "Failed to open %s codec\n",
av_get_media_type_string(type));
return ret;
@ -345,7 +345,7 @@ int main (int argc, char **argv)
if (audio_stream) {
enum AVSampleFormat sfmt = audio_dec_ctx->sample_fmt;
int n_channels = audio_dec_ctx->channels;
int n_channels = audio_dec_ctx->ch_layout.nb_channels;
const char *fmt;
if (av_sample_fmt_is_planar(sfmt)) {

View File

@ -70,26 +70,25 @@ static int select_sample_rate(const AVCodec *codec)
}
/* select layout with the highest channel count */
static int select_channel_layout(const AVCodec *codec)
static int select_channel_layout(const AVCodec *codec, AVChannelLayout *dst)
{
const uint64_t *p;
uint64_t best_ch_layout = 0;
const AVChannelLayout *p, *best_ch_layout;
int best_nb_channels = 0;
if (!codec->channel_layouts)
return AV_CH_LAYOUT_STEREO;
if (!codec->ch_layouts)
return av_channel_layout_copy(dst, &(AVChannelLayout)AV_CHANNEL_LAYOUT_STEREO);
p = codec->channel_layouts;
while (*p) {
int nb_channels = av_get_channel_layout_nb_channels(*p);
p = codec->ch_layouts;
while (p->nb_channels) {
int nb_channels = p->nb_channels;
if (nb_channels > best_nb_channels) {
best_ch_layout = *p;
best_ch_layout = p;
best_nb_channels = nb_channels;
}
p++;
}
return best_ch_layout;
return av_channel_layout_copy(dst, best_ch_layout);
}
static void encode(AVCodecContext *ctx, AVFrame *frame, AVPacket *pkt,
@ -164,8 +163,9 @@ int main(int argc, char **argv)
/* select other audio parameters supported by the encoder */
c->sample_rate = select_sample_rate(codec);
c->channel_layout = select_channel_layout(codec);
c->channels = av_get_channel_layout_nb_channels(c->channel_layout);
ret = select_channel_layout(codec, &c->ch_layout);
if (ret < 0)
exit(1);
/* open it */
if (avcodec_open2(c, codec, NULL) < 0) {
@ -195,7 +195,9 @@ int main(int argc, char **argv)
frame->nb_samples = c->frame_size;
frame->format = c->sample_fmt;
frame->channel_layout = c->channel_layout;
ret = av_channel_layout_copy(&frame->ch_layout, &c->ch_layout);
if (ret < 0)
exit(1);
/* allocate the data buffers */
ret = av_frame_get_buffer(frame, 0);
@ -218,7 +220,7 @@ int main(int argc, char **argv)
for (j = 0; j < c->frame_size; j++) {
samples[2*j] = (int)(sin(t) * 10000);
for (k = 1; k < c->channels; k++)
for (k = 1; k < c->ch_layout.nb_channels; k++)
samples[2*j + k] = samples[2*j];
t += tincr;
}

View File

@ -155,12 +155,25 @@ int main(int argc, char **argv)
for (i = 0; i < 25; i++) {
fflush(stdout);
/* make sure the frame data is writable */
/* Make sure the frame data is writable.
On the first round, the frame is fresh from av_frame_get_buffer()
and therefore we know it is writable.
But on the next rounds, encode() will have called
avcodec_send_frame(), and the codec may have kept a reference to
the frame in its internal structures, that makes the frame
unwritable.
av_frame_make_writable() checks that and allocates a new buffer
for the frame only if necessary.
*/
ret = av_frame_make_writable(frame);
if (ret < 0)
exit(1);
/* prepare a dummy image */
/* Prepare a dummy image.
In real code, this is where you would have your own logic for
filling the frame. FFmpeg does not care what you put in the
frame.
*/
/* Y */
for (y = 0; y < c->height; y++) {
for (x = 0; x < c->width; x++) {
@ -185,7 +198,12 @@ int main(int argc, char **argv)
/* flush the encoder */
encode(c, NULL, pkt, f);
/* add sequence end code to have a real MPEG file */
/* Add sequence end code to have a real MPEG file.
It makes only sense because this tiny examples writes packets
directly. This is called "elementary stream" and only works for some
codecs. To create a valid file, you usually need to write packets
into a proper file format or protocol; see muxing.c.
*/
if (codec->id == AV_CODEC_ID_MPEG1VIDEO || codec->id == AV_CODEC_ID_MPEG2VIDEO)
fwrite(endcode, 1, sizeof(endcode), f);
fclose(f);

View File

@ -22,6 +22,7 @@
*/
#include <libavutil/motion_vector.h>
#include <libavcodec/avcodec.h>
#include <libavformat/avformat.h>
static AVFormatContext *fmt_ctx = NULL;
@ -78,7 +79,7 @@ static int open_codec_context(AVFormatContext *fmt_ctx, enum AVMediaType type)
int ret;
AVStream *st;
AVCodecContext *dec_ctx = NULL;
AVCodec *dec = NULL;
const AVCodec *dec = NULL;
AVDictionary *opts = NULL;
ret = av_find_best_stream(fmt_ctx, type, -1, -1, &dec, 0);
@ -104,7 +105,9 @@ static int open_codec_context(AVFormatContext *fmt_ctx, enum AVMediaType type)
/* Init the video decoder */
av_dict_set(&opts, "flags2", "+export_mvs", 0);
if ((ret = avcodec_open2(dec_ctx, dec, &opts)) < 0) {
ret = avcodec_open2(dec_ctx, dec, &opts);
av_dict_free(&opts);
if (ret < 0) {
fprintf(stderr, "Failed to open %s codec\n",
av_get_media_type_string(type));
return ret;
@ -121,7 +124,7 @@ static int open_codec_context(AVFormatContext *fmt_ctx, enum AVMediaType type)
int main(int argc, char **argv)
{
int ret = 0;
AVPacket pkt = { 0 };
AVPacket *pkt = NULL;
if (argc != 2) {
fprintf(stderr, "Usage: %s <video>\n", argv[0]);
@ -156,13 +159,20 @@ int main(int argc, char **argv)
goto end;
}
pkt = av_packet_alloc();
if (!pkt) {
fprintf(stderr, "Could not allocate AVPacket\n");
ret = AVERROR(ENOMEM);
goto end;
}
printf("framenum,source,blockw,blockh,srcx,srcy,dstx,dsty,flags\n");
/* read frames from the file */
while (av_read_frame(fmt_ctx, &pkt) >= 0) {
if (pkt.stream_index == video_stream_idx)
ret = decode_packet(&pkt);
av_packet_unref(&pkt);
while (av_read_frame(fmt_ctx, pkt) >= 0) {
if (pkt->stream_index == video_stream_idx)
ret = decode_packet(pkt);
av_packet_unref(pkt);
if (ret < 0)
break;
}
@ -174,5 +184,6 @@ end:
avcodec_free_context(&video_dec_ctx);
avformat_close_input(&fmt_ctx);
av_frame_free(&frame);
av_packet_free(&pkt);
return ret < 0;
}

View File

@ -55,7 +55,7 @@
#define INPUT_SAMPLERATE 48000
#define INPUT_FORMAT AV_SAMPLE_FMT_FLTP
#define INPUT_CHANNEL_LAYOUT AV_CH_LAYOUT_5POINT0
#define INPUT_CHANNEL_LAYOUT (AVChannelLayout)AV_CHANNEL_LAYOUT_5POINT0
#define VOLUME_VAL 0.90
@ -100,7 +100,7 @@ static int init_filter_graph(AVFilterGraph **graph, AVFilterContext **src,
}
/* Set the filter options through the AVOptions API. */
av_get_channel_layout_string(ch_layout, sizeof(ch_layout), 0, INPUT_CHANNEL_LAYOUT);
av_channel_layout_describe(&INPUT_CHANNEL_LAYOUT, ch_layout, sizeof(ch_layout));
av_opt_set (abuffer_ctx, "channel_layout", ch_layout, AV_OPT_SEARCH_CHILDREN);
av_opt_set (abuffer_ctx, "sample_fmt", av_get_sample_fmt_name(INPUT_FORMAT), AV_OPT_SEARCH_CHILDREN);
av_opt_set_q (abuffer_ctx, "time_base", (AVRational){ 1, INPUT_SAMPLERATE }, AV_OPT_SEARCH_CHILDREN);
@ -154,9 +154,8 @@ static int init_filter_graph(AVFilterGraph **graph, AVFilterContext **src,
/* A third way of passing the options is in a string of the form
* key1=value1:key2=value2.... */
snprintf(options_str, sizeof(options_str),
"sample_fmts=%s:sample_rates=%d:channel_layouts=0x%"PRIx64,
av_get_sample_fmt_name(AV_SAMPLE_FMT_S16), 44100,
(uint64_t)AV_CH_LAYOUT_STEREO);
"sample_fmts=%s:sample_rates=%d:channel_layouts=stereo",
av_get_sample_fmt_name(AV_SAMPLE_FMT_S16), 44100);
err = avfilter_init_str(aformat_ctx, options_str);
if (err < 0) {
av_log(NULL, AV_LOG_ERROR, "Could not initialize the aformat filter.\n");
@ -215,7 +214,7 @@ static int init_filter_graph(AVFilterGraph **graph, AVFilterContext **src,
static int process_output(struct AVMD5 *md5, AVFrame *frame)
{
int planar = av_sample_fmt_is_planar(frame->format);
int channels = av_get_channel_layout_nb_channels(frame->channel_layout);
int channels = frame->ch_layout.nb_channels;
int planes = planar ? channels : 1;
int bps = av_get_bytes_per_sample(frame->format);
int plane_size = bps * frame->nb_samples * (planar ? 1 : channels);
@ -248,7 +247,7 @@ static int get_input(AVFrame *frame, int frame_num)
/* Set up the frame properties and allocate the buffer for the data. */
frame->sample_rate = INPUT_SAMPLERATE;
frame->format = INPUT_FORMAT;
frame->channel_layout = INPUT_CHANNEL_LAYOUT;
av_channel_layout_copy(&frame->ch_layout, &INPUT_CHANNEL_LAYOUT);
frame->nb_samples = FRAME_SIZE;
frame->pts = frame_num * FRAME_SIZE;

View File

@ -34,6 +34,7 @@
#include <libavformat/avformat.h>
#include <libavfilter/buffersink.h>
#include <libavfilter/buffersrc.h>
#include <libavutil/channel_layout.h>
#include <libavutil/opt.h>
static const char *filter_descr = "aresample=8000,aformat=sample_fmts=s16:channel_layouts=mono";
@ -48,8 +49,8 @@ static int audio_stream_index = -1;
static int open_input_file(const char *filename)
{
const AVCodec *dec;
int ret;
AVCodec *dec;
if ((ret = avformat_open_input(&fmt_ctx, filename, NULL, NULL)) < 0) {
av_log(NULL, AV_LOG_ERROR, "Cannot open input file\n");
@ -93,7 +94,6 @@ static int init_filters(const char *filters_descr)
AVFilterInOut *outputs = avfilter_inout_alloc();
AVFilterInOut *inputs = avfilter_inout_alloc();
static const enum AVSampleFormat out_sample_fmts[] = { AV_SAMPLE_FMT_S16, -1 };
static const int64_t out_channel_layouts[] = { AV_CH_LAYOUT_MONO, -1 };
static const int out_sample_rates[] = { 8000, -1 };
const AVFilterLink *outlink;
AVRational time_base = fmt_ctx->streams[audio_stream_index]->time_base;
@ -105,12 +105,13 @@ static int init_filters(const char *filters_descr)
}
/* buffer audio source: the decoded frames from the decoder will be inserted here. */
if (!dec_ctx->channel_layout)
dec_ctx->channel_layout = av_get_default_channel_layout(dec_ctx->channels);
snprintf(args, sizeof(args),
"time_base=%d/%d:sample_rate=%d:sample_fmt=%s:channel_layout=0x%"PRIx64,
if (dec_ctx->ch_layout.order == AV_CHANNEL_ORDER_UNSPEC)
av_channel_layout_default(&dec_ctx->ch_layout, dec_ctx->ch_layout.nb_channels);
ret = snprintf(args, sizeof(args),
"time_base=%d/%d:sample_rate=%d:sample_fmt=%s:channel_layout=",
time_base.num, time_base.den, dec_ctx->sample_rate,
av_get_sample_fmt_name(dec_ctx->sample_fmt), dec_ctx->channel_layout);
av_get_sample_fmt_name(dec_ctx->sample_fmt));
av_channel_layout_describe(&dec_ctx->ch_layout, args + ret, sizeof(args) - ret);
ret = avfilter_graph_create_filter(&buffersrc_ctx, abuffersrc, "in",
args, NULL, filter_graph);
if (ret < 0) {
@ -133,7 +134,7 @@ static int init_filters(const char *filters_descr)
goto end;
}
ret = av_opt_set_int_list(buffersink_ctx, "channel_layouts", out_channel_layouts, -1,
ret = av_opt_set(buffersink_ctx, "ch_layouts", "mono",
AV_OPT_SEARCH_CHILDREN);
if (ret < 0) {
av_log(NULL, AV_LOG_ERROR, "Cannot set output channel layout\n");
@ -184,7 +185,7 @@ static int init_filters(const char *filters_descr)
/* Print summary of the sink buffer
* Note: args buffer is reused to store channel layout string */
outlink = buffersink_ctx->inputs[0];
av_get_channel_layout_string(args, sizeof(args), -1, outlink->channel_layout);
av_channel_layout_describe(&outlink->ch_layout, args, sizeof(args));
av_log(NULL, AV_LOG_INFO, "Output: srate:%dHz fmt:%s chlayout:%s\n",
(int)outlink->sample_rate,
(char *)av_x_if_null(av_get_sample_fmt_name(outlink->format), "?"),
@ -199,7 +200,7 @@ end:
static void print_frame(const AVFrame *frame)
{
const int n = frame->nb_samples * av_get_channel_layout_nb_channels(frame->channel_layout);
const int n = frame->nb_samples * frame->ch_layout.nb_channels;
const uint16_t *p = (uint16_t*)frame->data[0];
const uint16_t *p_end = p + n;
@ -214,12 +215,12 @@ static void print_frame(const AVFrame *frame)
int main(int argc, char **argv)
{
int ret;
AVPacket packet;
AVPacket *packet = av_packet_alloc();
AVFrame *frame = av_frame_alloc();
AVFrame *filt_frame = av_frame_alloc();
if (!frame || !filt_frame) {
perror("Could not allocate frame");
if (!packet || !frame || !filt_frame) {
fprintf(stderr, "Could not allocate frame or packet\n");
exit(1);
}
if (argc != 2) {
@ -234,11 +235,11 @@ int main(int argc, char **argv)
/* read all packets */
while (1) {
if ((ret = av_read_frame(fmt_ctx, &packet)) < 0)
if ((ret = av_read_frame(fmt_ctx, packet)) < 0)
break;
if (packet.stream_index == audio_stream_index) {
ret = avcodec_send_packet(dec_ctx, &packet);
if (packet->stream_index == audio_stream_index) {
ret = avcodec_send_packet(dec_ctx, packet);
if (ret < 0) {
av_log(NULL, AV_LOG_ERROR, "Error while sending a packet to the decoder\n");
break;
@ -274,12 +275,13 @@ int main(int argc, char **argv)
}
}
}
av_packet_unref(&packet);
av_packet_unref(packet);
}
end:
avfilter_graph_free(&filter_graph);
avcodec_free_context(&dec_ctx);
avformat_close_input(&fmt_ctx);
av_packet_free(&packet);
av_frame_free(&frame);
av_frame_free(&filt_frame);

View File

@ -53,8 +53,8 @@ static int64_t last_pts = AV_NOPTS_VALUE;
static int open_input_file(const char *filename)
{
const AVCodec *dec;
int ret;
AVCodec *dec;
if ((ret = avformat_open_input(&fmt_ctx, filename, NULL, NULL)) < 0) {
av_log(NULL, AV_LOG_ERROR, "Cannot open input file\n");
@ -210,7 +210,7 @@ static void display_frame(const AVFrame *frame, AVRational time_base)
int main(int argc, char **argv)
{
int ret;
AVPacket packet;
AVPacket *packet;
AVFrame *frame;
AVFrame *filt_frame;
@ -221,8 +221,9 @@ int main(int argc, char **argv)
frame = av_frame_alloc();
filt_frame = av_frame_alloc();
if (!frame || !filt_frame) {
perror("Could not allocate frame");
packet = av_packet_alloc();
if (!frame || !filt_frame || !packet) {
fprintf(stderr, "Could not allocate frame or packet\n");
exit(1);
}
@ -233,11 +234,11 @@ int main(int argc, char **argv)
/* read all packets */
while (1) {
if ((ret = av_read_frame(fmt_ctx, &packet)) < 0)
if ((ret = av_read_frame(fmt_ctx, packet)) < 0)
break;
if (packet.stream_index == video_stream_index) {
ret = avcodec_send_packet(dec_ctx, &packet);
if (packet->stream_index == video_stream_index) {
ret = avcodec_send_packet(dec_ctx, packet);
if (ret < 0) {
av_log(NULL, AV_LOG_ERROR, "Error while sending a packet to the decoder\n");
break;
@ -273,7 +274,7 @@ int main(int argc, char **argv)
av_frame_unref(frame);
}
}
av_packet_unref(&packet);
av_packet_unref(packet);
}
end:
avfilter_graph_free(&filter_graph);
@ -281,6 +282,7 @@ end:
avformat_close_input(&fmt_ctx);
av_frame_free(&frame);
av_frame_free(&filt_frame);
av_packet_free(&packet);
if (ret < 0 && ret != AVERROR_EOF) {
fprintf(stderr, "Error occurred: %s\n", av_err2str(ret));

View File

@ -152,8 +152,8 @@ int main(int argc, char *argv[])
int video_stream, ret;
AVStream *video = NULL;
AVCodecContext *decoder_ctx = NULL;
AVCodec *decoder = NULL;
AVPacket packet;
const AVCodec *decoder = NULL;
AVPacket *packet = NULL;
enum AVHWDeviceType type;
int i;
@ -172,6 +172,12 @@ int main(int argc, char *argv[])
return -1;
}
packet = av_packet_alloc();
if (!packet) {
fprintf(stderr, "Failed to allocate AVPacket\n");
return -1;
}
/* open the input file */
if (avformat_open_input(&input_ctx, argv[2], NULL, NULL) != 0) {
fprintf(stderr, "Cannot open input file '%s'\n", argv[2]);
@ -227,23 +233,21 @@ int main(int argc, char *argv[])
/* actual decoding and dump the raw data */
while (ret >= 0) {
if ((ret = av_read_frame(input_ctx, &packet)) < 0)
if ((ret = av_read_frame(input_ctx, packet)) < 0)
break;
if (video_stream == packet.stream_index)
ret = decode_write(decoder_ctx, &packet);
if (video_stream == packet->stream_index)
ret = decode_write(decoder_ctx, packet);
av_packet_unref(&packet);
av_packet_unref(packet);
}
/* flush the decoder */
packet.data = NULL;
packet.size = 0;
ret = decode_write(decoder_ctx, &packet);
av_packet_unref(&packet);
ret = decode_write(decoder_ctx, NULL);
if (output_file)
fclose(output_file);
av_packet_free(&packet);
avcodec_free_context(&decoder_ctx);
avformat_close_input(&input_ctx);
av_buffer_unref(&hw_device_ctx);

View File

@ -34,7 +34,7 @@
int main (int argc, char **argv)
{
AVFormatContext *fmt_ctx = NULL;
AVDictionaryEntry *tag = NULL;
const AVDictionaryEntry *tag = NULL;
int ret;
if (argc != 2) {

View File

@ -39,6 +39,7 @@
#include <libavutil/opt.h>
#include <libavutil/mathematics.h>
#include <libavutil/timestamp.h>
#include <libavcodec/avcodec.h>
#include <libavformat/avformat.h>
#include <libswscale/swscale.h>
#include <libswresample/swresample.h>
@ -61,6 +62,8 @@ typedef struct OutputStream {
AVFrame *frame;
AVFrame *tmp_frame;
AVPacket *tmp_pkt;
float t, tincr, tincr2;
struct SwsContext *sws_ctx;
@ -79,7 +82,7 @@ static void log_packet(const AVFormatContext *fmt_ctx, const AVPacket *pkt)
}
static int write_frame(AVFormatContext *fmt_ctx, AVCodecContext *c,
AVStream *st, AVFrame *frame)
AVStream *st, AVFrame *frame, AVPacket *pkt)
{
int ret;
@ -92,9 +95,7 @@ static int write_frame(AVFormatContext *fmt_ctx, AVCodecContext *c,
}
while (ret >= 0) {
AVPacket pkt = { 0 };
ret = avcodec_receive_packet(c, &pkt);
ret = avcodec_receive_packet(c, pkt);
if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF)
break;
else if (ret < 0) {
@ -103,13 +104,15 @@ static int write_frame(AVFormatContext *fmt_ctx, AVCodecContext *c,
}
/* rescale output packet timestamp values from codec to stream timebase */
av_packet_rescale_ts(&pkt, c->time_base, st->time_base);
pkt.stream_index = st->index;
av_packet_rescale_ts(pkt, c->time_base, st->time_base);
pkt->stream_index = st->index;
/* Write the compressed frame to the media file. */
log_packet(fmt_ctx, &pkt);
ret = av_interleaved_write_frame(fmt_ctx, &pkt);
av_packet_unref(&pkt);
log_packet(fmt_ctx, pkt);
ret = av_interleaved_write_frame(fmt_ctx, pkt);
/* pkt is now blank (av_interleaved_write_frame() takes ownership of
* its contents and resets pkt), so that no unreferencing is necessary.
* This would be different if one used av_write_frame(). */
if (ret < 0) {
fprintf(stderr, "Error while writing output packet: %s\n", av_err2str(ret));
exit(1);
@ -121,7 +124,7 @@ static int write_frame(AVFormatContext *fmt_ctx, AVCodecContext *c,
/* Add an output stream. */
static void add_stream(OutputStream *ost, AVFormatContext *oc,
AVCodec **codec,
const AVCodec **codec,
enum AVCodecID codec_id)
{
AVCodecContext *c;
@ -135,6 +138,12 @@ static void add_stream(OutputStream *ost, AVFormatContext *oc,
exit(1);
}
ost->tmp_pkt = av_packet_alloc();
if (!ost->tmp_pkt) {
fprintf(stderr, "Could not allocate AVPacket\n");
exit(1);
}
ost->st = avformat_new_stream(oc, NULL);
if (!ost->st) {
fprintf(stderr, "Could not allocate stream\n");
@ -161,16 +170,7 @@ static void add_stream(OutputStream *ost, AVFormatContext *oc,
c->sample_rate = 44100;
}
}
c->channels = av_get_channel_layout_nb_channels(c->channel_layout);
c->channel_layout = AV_CH_LAYOUT_STEREO;
if ((*codec)->channel_layouts) {
c->channel_layout = (*codec)->channel_layouts[0];
for (i = 0; (*codec)->channel_layouts[i]; i++) {
if ((*codec)->channel_layouts[i] == AV_CH_LAYOUT_STEREO)
c->channel_layout = AV_CH_LAYOUT_STEREO;
}
}
c->channels = av_get_channel_layout_nb_channels(c->channel_layout);
av_channel_layout_copy(&c->ch_layout, &(AVChannelLayout)AV_CHANNEL_LAYOUT_STEREO);
ost->st->time_base = (AVRational){ 1, c->sample_rate };
break;
@ -215,7 +215,7 @@ static void add_stream(OutputStream *ost, AVFormatContext *oc,
/* audio output */
static AVFrame *alloc_audio_frame(enum AVSampleFormat sample_fmt,
uint64_t channel_layout,
const AVChannelLayout *channel_layout,
int sample_rate, int nb_samples)
{
AVFrame *frame = av_frame_alloc();
@ -227,7 +227,7 @@ static AVFrame *alloc_audio_frame(enum AVSampleFormat sample_fmt,
}
frame->format = sample_fmt;
frame->channel_layout = channel_layout;
av_channel_layout_copy(&frame->ch_layout, channel_layout);
frame->sample_rate = sample_rate;
frame->nb_samples = nb_samples;
@ -242,7 +242,8 @@ static AVFrame *alloc_audio_frame(enum AVSampleFormat sample_fmt,
return frame;
}
static void open_audio(AVFormatContext *oc, AVCodec *codec, OutputStream *ost, AVDictionary *opt_arg)
static void open_audio(AVFormatContext *oc, const AVCodec *codec,
OutputStream *ost, AVDictionary *opt_arg)
{
AVCodecContext *c;
int nb_samples;
@ -271,9 +272,9 @@ static void open_audio(AVFormatContext *oc, AVCodec *codec, OutputStream *ost, A
else
nb_samples = c->frame_size;
ost->frame = alloc_audio_frame(c->sample_fmt, c->channel_layout,
ost->frame = alloc_audio_frame(c->sample_fmt, &c->ch_layout,
c->sample_rate, nb_samples);
ost->tmp_frame = alloc_audio_frame(AV_SAMPLE_FMT_S16, c->channel_layout,
ost->tmp_frame = alloc_audio_frame(AV_SAMPLE_FMT_S16, &c->ch_layout,
c->sample_rate, nb_samples);
/* copy the stream parameters to the muxer */
@ -291,10 +292,10 @@ static void open_audio(AVFormatContext *oc, AVCodec *codec, OutputStream *ost, A
}
/* set options */
av_opt_set_int (ost->swr_ctx, "in_channel_count", c->channels, 0);
av_opt_set_chlayout (ost->swr_ctx, "in_chlayout", &c->ch_layout, 0);
av_opt_set_int (ost->swr_ctx, "in_sample_rate", c->sample_rate, 0);
av_opt_set_sample_fmt(ost->swr_ctx, "in_sample_fmt", AV_SAMPLE_FMT_S16, 0);
av_opt_set_int (ost->swr_ctx, "out_channel_count", c->channels, 0);
av_opt_set_chlayout (ost->swr_ctx, "out_chlayout", &c->ch_layout, 0);
av_opt_set_int (ost->swr_ctx, "out_sample_rate", c->sample_rate, 0);
av_opt_set_sample_fmt(ost->swr_ctx, "out_sample_fmt", c->sample_fmt, 0);
@ -320,7 +321,7 @@ static AVFrame *get_audio_frame(OutputStream *ost)
for (j = 0; j <frame->nb_samples; j++) {
v = (int)(sin(ost->t) * 10000);
for (i = 0; i < ost->enc->channels; i++)
for (i = 0; i < ost->enc->ch_layout.nb_channels; i++)
*q++ = v;
ost->t += ost->tincr;
ost->tincr += ost->tincr2;
@ -376,7 +377,7 @@ static int write_audio_frame(AVFormatContext *oc, OutputStream *ost)
ost->samples_count += dst_nb_samples;
}
return write_frame(oc, c, ost->st, frame);
return write_frame(oc, c, ost->st, frame, ost->tmp_pkt);
}
/**************************************************************/
@ -405,7 +406,8 @@ static AVFrame *alloc_picture(enum AVPixelFormat pix_fmt, int width, int height)
return picture;
}
static void open_video(AVFormatContext *oc, AVCodec *codec, OutputStream *ost, AVDictionary *opt_arg)
static void open_video(AVFormatContext *oc, const AVCodec *codec,
OutputStream *ost, AVDictionary *opt_arg)
{
int ret;
AVCodecContext *c = ost->enc;
@ -518,7 +520,7 @@ static AVFrame *get_video_frame(OutputStream *ost)
*/
static int write_video_frame(AVFormatContext *oc, OutputStream *ost)
{
return write_frame(oc, ost->enc, ost->st, get_video_frame(ost));
return write_frame(oc, ost->enc, ost->st, get_video_frame(ost), ost->tmp_pkt);
}
static void close_stream(AVFormatContext *oc, OutputStream *ost)
@ -526,6 +528,7 @@ static void close_stream(AVFormatContext *oc, OutputStream *ost)
avcodec_free_context(&ost->enc);
av_frame_free(&ost->frame);
av_frame_free(&ost->tmp_frame);
av_packet_free(&ost->tmp_pkt);
sws_freeContext(ost->sws_ctx);
swr_free(&ost->swr_ctx);
}
@ -536,10 +539,10 @@ static void close_stream(AVFormatContext *oc, OutputStream *ost)
int main(int argc, char **argv)
{
OutputStream video_st = { 0 }, audio_st = { 0 };
const AVOutputFormat *fmt;
const char *filename;
AVOutputFormat *fmt;
AVFormatContext *oc;
AVCodec *audio_codec, *video_codec;
const AVCodec *audio_codec, *video_codec;
int ret;
int have_video = 0, have_audio = 0;
int encode_video = 0, encode_audio = 0;
@ -626,10 +629,6 @@ int main(int argc, char **argv)
}
}
/* Write the trailer, if any. The trailer must be written before you
* close the CodecContexts open when you wrote the header; otherwise
* av_write_trailer() may try to use memory that was freed on
* av_codec_close(). */
av_write_trailer(oc);
/* Close each codec. */

View File

@ -44,38 +44,10 @@
#include "libavutil/hwcontext_qsv.h"
#include "libavutil/mem.h"
typedef struct DecodeContext {
AVBufferRef *hw_device_ref;
} DecodeContext;
static int get_format(AVCodecContext *avctx, const enum AVPixelFormat *pix_fmts)
{
while (*pix_fmts != AV_PIX_FMT_NONE) {
if (*pix_fmts == AV_PIX_FMT_QSV) {
DecodeContext *decode = avctx->opaque;
AVHWFramesContext *frames_ctx;
AVQSVFramesContext *frames_hwctx;
int ret;
/* create a pool of surfaces to be used by the decoder */
avctx->hw_frames_ctx = av_hwframe_ctx_alloc(decode->hw_device_ref);
if (!avctx->hw_frames_ctx)
return AV_PIX_FMT_NONE;
frames_ctx = (AVHWFramesContext*)avctx->hw_frames_ctx->data;
frames_hwctx = frames_ctx->hwctx;
frames_ctx->format = AV_PIX_FMT_QSV;
frames_ctx->sw_format = avctx->sw_pix_fmt;
frames_ctx->width = FFALIGN(avctx->coded_width, 32);
frames_ctx->height = FFALIGN(avctx->coded_height, 32);
frames_ctx->initial_pool_size = 32;
frames_hwctx->frame_type = MFX_MEMTYPE_VIDEO_MEMORY_DECODER_TARGET;
ret = av_hwframe_ctx_init(avctx->hw_frames_ctx);
if (ret < 0)
return AV_PIX_FMT_NONE;
return AV_PIX_FMT_QSV;
}
@ -87,7 +59,7 @@ static int get_format(AVCodecContext *avctx, const enum AVPixelFormat *pix_fmts)
return AV_PIX_FMT_NONE;
}
static int decode_packet(DecodeContext *decode, AVCodecContext *decoder_ctx,
static int decode_packet(AVCodecContext *decoder_ctx,
AVFrame *frame, AVFrame *sw_frame,
AVPacket *pkt, AVIOContext *output_ctx)
{
@ -141,15 +113,15 @@ int main(int argc, char **argv)
AVCodecContext *decoder_ctx = NULL;
const AVCodec *decoder;
AVPacket pkt = { 0 };
AVPacket *pkt = NULL;
AVFrame *frame = NULL, *sw_frame = NULL;
DecodeContext decode = { NULL };
AVIOContext *output_ctx = NULL;
int ret, i;
AVBufferRef *device_ref = NULL;
if (argc < 3) {
fprintf(stderr, "Usage: %s <input file> <output file>\n", argv[0]);
return 1;
@ -177,7 +149,7 @@ int main(int argc, char **argv)
}
/* open the hardware device */
ret = av_hwdevice_ctx_create(&decode.hw_device_ref, AV_HWDEVICE_TYPE_QSV,
ret = av_hwdevice_ctx_create(&device_ref, AV_HWDEVICE_TYPE_QSV,
"auto", NULL, 0);
if (ret < 0) {
fprintf(stderr, "Cannot open the hardware device\n");
@ -209,7 +181,8 @@ int main(int argc, char **argv)
decoder_ctx->extradata_size = video_st->codecpar->extradata_size;
}
decoder_ctx->opaque = &decode;
decoder_ctx->hw_device_ctx = av_buffer_ref(device_ref);
decoder_ctx->get_format = get_format;
ret = avcodec_open2(decoder_ctx, NULL, NULL);
@ -227,27 +200,26 @@ int main(int argc, char **argv)
frame = av_frame_alloc();
sw_frame = av_frame_alloc();
if (!frame || !sw_frame) {
pkt = av_packet_alloc();
if (!frame || !sw_frame || !pkt) {
ret = AVERROR(ENOMEM);
goto finish;
}
/* actual decoding */
while (ret >= 0) {
ret = av_read_frame(input_ctx, &pkt);
ret = av_read_frame(input_ctx, pkt);
if (ret < 0)
break;
if (pkt.stream_index == video_st->index)
ret = decode_packet(&decode, decoder_ctx, frame, sw_frame, &pkt, output_ctx);
if (pkt->stream_index == video_st->index)
ret = decode_packet(decoder_ctx, frame, sw_frame, pkt, output_ctx);
av_packet_unref(&pkt);
av_packet_unref(pkt);
}
/* flush the decoder */
pkt.data = NULL;
pkt.size = 0;
ret = decode_packet(&decode, decoder_ctx, frame, sw_frame, &pkt, output_ctx);
ret = decode_packet(decoder_ctx, frame, sw_frame, NULL, output_ctx);
finish:
if (ret < 0) {
@ -260,10 +232,11 @@ finish:
av_frame_free(&frame);
av_frame_free(&sw_frame);
av_packet_free(&pkt);
avcodec_free_context(&decoder_ctx);
av_buffer_unref(&decode.hw_device_ref);
av_buffer_unref(&device_ref);
avio_close(output_ctx);

View File

@ -45,9 +45,9 @@ static void log_packet(const AVFormatContext *fmt_ctx, const AVPacket *pkt, cons
int main(int argc, char **argv)
{
AVOutputFormat *ofmt = NULL;
const AVOutputFormat *ofmt = NULL;
AVFormatContext *ifmt_ctx = NULL, *ofmt_ctx = NULL;
AVPacket pkt;
AVPacket *pkt = NULL;
const char *in_filename, *out_filename;
int ret, i;
int stream_index = 0;
@ -65,6 +65,12 @@ int main(int argc, char **argv)
in_filename = argv[1];
out_filename = argv[2];
pkt = av_packet_alloc();
if (!pkt) {
fprintf(stderr, "Could not allocate AVPacket\n");
return 1;
}
if ((ret = avformat_open_input(&ifmt_ctx, in_filename, 0, 0)) < 0) {
fprintf(stderr, "Could not open input file '%s'", in_filename);
goto end;
@ -85,7 +91,7 @@ int main(int argc, char **argv)
}
stream_mapping_size = ifmt_ctx->nb_streams;
stream_mapping = av_mallocz_array(stream_mapping_size, sizeof(*stream_mapping));
stream_mapping = av_calloc(stream_mapping_size, sizeof(*stream_mapping));
if (!stream_mapping) {
ret = AVERROR(ENOMEM);
goto end;
@ -140,38 +146,39 @@ int main(int argc, char **argv)
while (1) {
AVStream *in_stream, *out_stream;
ret = av_read_frame(ifmt_ctx, &pkt);
ret = av_read_frame(ifmt_ctx, pkt);
if (ret < 0)
break;
in_stream = ifmt_ctx->streams[pkt.stream_index];
if (pkt.stream_index >= stream_mapping_size ||
stream_mapping[pkt.stream_index] < 0) {
av_packet_unref(&pkt);
in_stream = ifmt_ctx->streams[pkt->stream_index];
if (pkt->stream_index >= stream_mapping_size ||
stream_mapping[pkt->stream_index] < 0) {
av_packet_unref(pkt);
continue;
}
pkt.stream_index = stream_mapping[pkt.stream_index];
out_stream = ofmt_ctx->streams[pkt.stream_index];
log_packet(ifmt_ctx, &pkt, "in");
pkt->stream_index = stream_mapping[pkt->stream_index];
out_stream = ofmt_ctx->streams[pkt->stream_index];
log_packet(ifmt_ctx, pkt, "in");
/* copy packet */
pkt.pts = av_rescale_q_rnd(pkt.pts, in_stream->time_base, out_stream->time_base, AV_ROUND_NEAR_INF|AV_ROUND_PASS_MINMAX);
pkt.dts = av_rescale_q_rnd(pkt.dts, in_stream->time_base, out_stream->time_base, AV_ROUND_NEAR_INF|AV_ROUND_PASS_MINMAX);
pkt.duration = av_rescale_q(pkt.duration, in_stream->time_base, out_stream->time_base);
pkt.pos = -1;
log_packet(ofmt_ctx, &pkt, "out");
av_packet_rescale_ts(pkt, in_stream->time_base, out_stream->time_base);
pkt->pos = -1;
log_packet(ofmt_ctx, pkt, "out");
ret = av_interleaved_write_frame(ofmt_ctx, &pkt);
ret = av_interleaved_write_frame(ofmt_ctx, pkt);
/* pkt is now blank (av_interleaved_write_frame() takes ownership of
* its contents and resets pkt), so that no unreferencing is necessary.
* This would be different if one used av_write_frame(). */
if (ret < 0) {
fprintf(stderr, "Error muxing packet\n");
break;
}
av_packet_unref(&pkt);
}
av_write_trailer(ofmt_ctx);
end:
av_packet_free(&pkt);
avformat_close_input(&ifmt_ctx);

View File

@ -80,7 +80,7 @@ static void fill_samples(double *dst, int nb_samples, int nb_channels, int sampl
int main(int argc, char **argv)
{
int64_t src_ch_layout = AV_CH_LAYOUT_STEREO, dst_ch_layout = AV_CH_LAYOUT_SURROUND;
AVChannelLayout src_ch_layout = AV_CHANNEL_LAYOUT_STEREO, dst_ch_layout = AV_CHANNEL_LAYOUT_SURROUND;
int src_rate = 48000, dst_rate = 44100;
uint8_t **src_data = NULL, **dst_data = NULL;
int src_nb_channels = 0, dst_nb_channels = 0;
@ -92,6 +92,7 @@ int main(int argc, char **argv)
int dst_bufsize;
const char *fmt;
struct SwrContext *swr_ctx;
char buf[64];
double t;
int ret;
@ -120,11 +121,11 @@ int main(int argc, char **argv)
}
/* set options */
av_opt_set_int(swr_ctx, "in_channel_layout", src_ch_layout, 0);
av_opt_set_chlayout(swr_ctx, "in_chlayout", &src_ch_layout, 0);
av_opt_set_int(swr_ctx, "in_sample_rate", src_rate, 0);
av_opt_set_sample_fmt(swr_ctx, "in_sample_fmt", src_sample_fmt, 0);
av_opt_set_int(swr_ctx, "out_channel_layout", dst_ch_layout, 0);
av_opt_set_chlayout(swr_ctx, "out_chlayout", &dst_ch_layout, 0);
av_opt_set_int(swr_ctx, "out_sample_rate", dst_rate, 0);
av_opt_set_sample_fmt(swr_ctx, "out_sample_fmt", dst_sample_fmt, 0);
@ -136,7 +137,7 @@ int main(int argc, char **argv)
/* allocate source and destination samples buffers */
src_nb_channels = av_get_channel_layout_nb_channels(src_ch_layout);
src_nb_channels = src_ch_layout.nb_channels;
ret = av_samples_alloc_array_and_samples(&src_data, &src_linesize, src_nb_channels,
src_nb_samples, src_sample_fmt, 0);
if (ret < 0) {
@ -151,7 +152,7 @@ int main(int argc, char **argv)
av_rescale_rnd(src_nb_samples, dst_rate, src_rate, AV_ROUND_UP);
/* buffer is going to be directly written to a rawaudio file, no alignment */
dst_nb_channels = av_get_channel_layout_nb_channels(dst_ch_layout);
dst_nb_channels = dst_ch_layout.nb_channels;
ret = av_samples_alloc_array_and_samples(&dst_data, &dst_linesize, dst_nb_channels,
dst_nb_samples, dst_sample_fmt, 0);
if (ret < 0) {
@ -194,9 +195,10 @@ int main(int argc, char **argv)
if ((ret = get_format_from_sample_fmt(&fmt, dst_sample_fmt)) < 0)
goto end;
av_channel_layout_describe(&dst_ch_layout, buf, sizeof(buf));
fprintf(stderr, "Resampling succeeded. Play the output file with the command:\n"
"ffplay -f %s -channel_layout %"PRId64" -channels %d -ar %d %s\n",
fmt, dst_ch_layout, dst_nb_channels, dst_rate, dst_filename);
"ffplay -f %s -channel_layout %s -channels %d -ar %d %s\n",
fmt, buf, dst_nb_channels, dst_rate, dst_filename);
end:
fclose(dst_file);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2013-2018 Andreas Unterweger
* Copyright (c) 2013-2022 Andreas Unterweger
*
* This file is part of FFmpeg.
*
@ -38,6 +38,7 @@
#include "libavutil/audio_fifo.h"
#include "libavutil/avassert.h"
#include "libavutil/avstring.h"
#include "libavutil/channel_layout.h"
#include "libavutil/frame.h"
#include "libavutil/opt.h"
@ -60,7 +61,8 @@ static int open_input_file(const char *filename,
AVCodecContext **input_codec_context)
{
AVCodecContext *avctx;
AVCodec *input_codec;
const AVCodec *input_codec;
const AVStream *stream;
int error;
/* Open the input file to read from it. */
@ -88,8 +90,10 @@ static int open_input_file(const char *filename,
return AVERROR_EXIT;
}
stream = (*input_format_context)->streams[0];
/* Find a decoder for the audio stream. */
if (!(input_codec = avcodec_find_decoder((*input_format_context)->streams[0]->codecpar->codec_id))) {
if (!(input_codec = avcodec_find_decoder(stream->codecpar->codec_id))) {
fprintf(stderr, "Could not find input codec\n");
avformat_close_input(input_format_context);
return AVERROR_EXIT;
@ -104,7 +108,7 @@ static int open_input_file(const char *filename,
}
/* Initialize the stream parameters with demuxer information. */
error = avcodec_parameters_to_context(avctx, (*input_format_context)->streams[0]->codecpar);
error = avcodec_parameters_to_context(avctx, stream->codecpar);
if (error < 0) {
avformat_close_input(input_format_context);
avcodec_free_context(&avctx);
@ -120,6 +124,9 @@ static int open_input_file(const char *filename,
return error;
}
/* Set the packet timebase for the decoder. */
avctx->pkt_timebase = stream->time_base;
/* Save the decoder context for easier access later. */
*input_codec_context = avctx;
@ -144,7 +151,7 @@ static int open_output_file(const char *filename,
AVCodecContext *avctx = NULL;
AVIOContext *output_io_context = NULL;
AVStream *stream = NULL;
AVCodec *output_codec = NULL;
const AVCodec *output_codec = NULL;
int error;
/* Open the output file to write to it. */
@ -199,15 +206,11 @@ static int open_output_file(const char *filename,
/* Set the basic encoder parameters.
* The input file's sample rate is used to avoid a sample rate conversion. */
avctx->channels = OUTPUT_CHANNELS;
avctx->channel_layout = av_get_default_channel_layout(OUTPUT_CHANNELS);
av_channel_layout_default(&avctx->ch_layout, OUTPUT_CHANNELS);
avctx->sample_rate = input_codec_context->sample_rate;
avctx->sample_fmt = output_codec->sample_fmts[0];
avctx->bit_rate = OUTPUT_BIT_RATE;
/* Allow the use of the experimental AAC encoder. */
avctx->strict_std_compliance = FF_COMPLIANCE_EXPERIMENTAL;
/* Set the sample rate for the container. */
stream->time_base.den = input_codec_context->sample_rate;
stream->time_base.num = 1;
@ -289,21 +292,18 @@ static int init_resampler(AVCodecContext *input_codec_context,
/*
* Create a resampler context for the conversion.
* Set the conversion parameters.
* Default channel layouts based on the number of channels
* are assumed for simplicity (they are sometimes not detected
* properly by the demuxer and/or decoder).
*/
*resample_context = swr_alloc_set_opts(NULL,
av_get_default_channel_layout(output_codec_context->channels),
error = swr_alloc_set_opts2(resample_context,
&output_codec_context->ch_layout,
output_codec_context->sample_fmt,
output_codec_context->sample_rate,
av_get_default_channel_layout(input_codec_context->channels),
&input_codec_context->ch_layout,
input_codec_context->sample_fmt,
input_codec_context->sample_rate,
0, NULL);
if (!*resample_context) {
if (error < 0) {
fprintf(stderr, "Could not allocate resample context\n");
return AVERROR(ENOMEM);
return error;
}
/*
* Perform a sanity check so that the number of converted samples is
@ -331,7 +331,7 @@ static int init_fifo(AVAudioFifo **fifo, AVCodecContext *output_codec_context)
{
/* Create the FIFO buffer based on the specified output sample format. */
if (!(*fifo = av_audio_fifo_alloc(output_codec_context->sample_fmt,
output_codec_context->channels, 1))) {
output_codec_context->ch_layout.nb_channels, 1))) {
fprintf(stderr, "Could not allocate FIFO\n");
return AVERROR(ENOMEM);
}
@ -380,6 +380,8 @@ static int decode_audio_frame(AVFrame *frame,
if (error < 0)
return error;
*data_present = 0;
*finished = 0;
/* Read one audio frame from the input file into a temporary packet. */
if ((error = av_read_frame(input_format_context, input_packet)) < 0) {
/* If we are at the end of the file, flush the decoder below. */
@ -449,7 +451,7 @@ static int init_converted_samples(uint8_t ***converted_input_samples,
* Each pointer will later point to the audio samples of the corresponding
* channels (although it may be NULL for interleaved formats).
*/
if (!(*converted_input_samples = calloc(output_codec_context->channels,
if (!(*converted_input_samples = calloc(output_codec_context->ch_layout.nb_channels,
sizeof(**converted_input_samples)))) {
fprintf(stderr, "Could not allocate converted input sample pointers\n");
return AVERROR(ENOMEM);
@ -458,7 +460,7 @@ static int init_converted_samples(uint8_t ***converted_input_samples,
/* Allocate memory for the samples of all channels in one consecutive
* block for convenience. */
if ((error = av_samples_alloc(*converted_input_samples, NULL,
output_codec_context->channels,
output_codec_context->ch_layout.nb_channels,
frame_size,
output_codec_context->sample_fmt, 0)) < 0) {
fprintf(stderr,
@ -558,7 +560,7 @@ static int read_decode_convert_and_store(AVAudioFifo *fifo,
AVFrame *input_frame = NULL;
/* Temporary storage for the converted input samples. */
uint8_t **converted_input_samples = NULL;
int data_present = 0;
int data_present;
int ret = AVERROR_EXIT;
/* Initialize temporary storage for one input frame. */
@ -632,7 +634,7 @@ static int init_output_frame(AVFrame **frame,
* Default channel layouts based on the number of channels
* are assumed for simplicity. */
(*frame)->nb_samples = frame_size;
(*frame)->channel_layout = output_codec_context->channel_layout;
av_channel_layout_copy(&(*frame)->ch_layout, &output_codec_context->ch_layout);
(*frame)->format = output_codec_context->sample_fmt;
(*frame)->sample_rate = output_codec_context->sample_rate;
@ -679,17 +681,16 @@ static int encode_audio_frame(AVFrame *frame,
pts += frame->nb_samples;
}
*data_present = 0;
/* Send the audio frame stored in the temporary packet to the encoder.
* The output audio stream encoder is used to do this. */
error = avcodec_send_frame(output_codec_context, frame);
/* The encoder signals that it has nothing more to encode. */
if (error == AVERROR_EOF) {
error = 0;
goto cleanup;
} else if (error < 0) {
fprintf(stderr, "Could not send packet for encoding (error '%s')\n",
av_err2str(error));
goto cleanup;
/* Check for errors, but proceed with fetching encoded samples if the
* encoder signals that it has nothing more to encode. */
if (error < 0 && error != AVERROR_EOF) {
fprintf(stderr, "Could not send packet for encoding (error '%s')\n",
av_err2str(error));
goto cleanup;
}
/* Receive one encoded frame from the encoder. */
@ -860,7 +861,6 @@ int main(int argc, char **argv)
int data_written;
/* Flush the encoder as it may have delayed frames. */
do {
data_written = 0;
if (encode_audio_frame(NULL, output_format_context,
output_codec_context, &data_written))
goto cleanup;

View File

@ -32,6 +32,7 @@
#include <libavformat/avformat.h>
#include <libavfilter/buffersink.h>
#include <libavfilter/buffersrc.h>
#include <libavutil/channel_layout.h>
#include <libavutil/opt.h>
#include <libavutil/pixdesc.h>
@ -71,13 +72,13 @@ static int open_input_file(const char *filename)
return ret;
}
stream_ctx = av_mallocz_array(ifmt_ctx->nb_streams, sizeof(*stream_ctx));
stream_ctx = av_calloc(ifmt_ctx->nb_streams, sizeof(*stream_ctx));
if (!stream_ctx)
return AVERROR(ENOMEM);
for (i = 0; i < ifmt_ctx->nb_streams; i++) {
AVStream *stream = ifmt_ctx->streams[i];
AVCodec *dec = avcodec_find_decoder(stream->codecpar->codec_id);
const AVCodec *dec = avcodec_find_decoder(stream->codecpar->codec_id);
AVCodecContext *codec_ctx;
if (!dec) {
av_log(NULL, AV_LOG_ERROR, "Failed to find decoder for stream #%u\n", i);
@ -122,7 +123,7 @@ static int open_output_file(const char *filename)
AVStream *out_stream;
AVStream *in_stream;
AVCodecContext *dec_ctx, *enc_ctx;
AVCodec *encoder;
const AVCodec *encoder;
int ret;
unsigned int i;
@ -174,8 +175,9 @@ static int open_output_file(const char *filename)
enc_ctx->time_base = av_inv_q(dec_ctx->framerate);
} else {
enc_ctx->sample_rate = dec_ctx->sample_rate;
enc_ctx->channel_layout = dec_ctx->channel_layout;
enc_ctx->channels = av_get_channel_layout_nb_channels(enc_ctx->channel_layout);
ret = av_channel_layout_copy(&enc_ctx->ch_layout, &dec_ctx->ch_layout);
if (ret < 0)
return ret;
/* take first format from list of supported formats */
enc_ctx->sample_fmt = encoder->sample_fmts[0];
enc_ctx->time_base = (AVRational){1, enc_ctx->sample_rate};
@ -288,6 +290,7 @@ static int init_filter(FilteringContext* fctx, AVCodecContext *dec_ctx,
goto end;
}
} else if (dec_ctx->codec_type == AVMEDIA_TYPE_AUDIO) {
char buf[64];
buffersrc = avfilter_get_by_name("abuffer");
buffersink = avfilter_get_by_name("abuffersink");
if (!buffersrc || !buffersink) {
@ -296,14 +299,14 @@ static int init_filter(FilteringContext* fctx, AVCodecContext *dec_ctx,
goto end;
}
if (!dec_ctx->channel_layout)
dec_ctx->channel_layout =
av_get_default_channel_layout(dec_ctx->channels);
if (dec_ctx->ch_layout.order == AV_CHANNEL_ORDER_UNSPEC)
av_channel_layout_default(&dec_ctx->ch_layout, dec_ctx->ch_layout.nb_channels);
av_channel_layout_describe(&dec_ctx->ch_layout, buf, sizeof(buf));
snprintf(args, sizeof(args),
"time_base=%d/%d:sample_rate=%d:sample_fmt=%s:channel_layout=0x%"PRIx64,
"time_base=%d/%d:sample_rate=%d:sample_fmt=%s:channel_layout=%s",
dec_ctx->time_base.num, dec_ctx->time_base.den, dec_ctx->sample_rate,
av_get_sample_fmt_name(dec_ctx->sample_fmt),
dec_ctx->channel_layout);
buf);
ret = avfilter_graph_create_filter(&buffersrc_ctx, buffersrc, "in",
args, NULL, filter_graph);
if (ret < 0) {
@ -326,9 +329,9 @@ static int init_filter(FilteringContext* fctx, AVCodecContext *dec_ctx,
goto end;
}
ret = av_opt_set_bin(buffersink_ctx, "channel_layouts",
(uint8_t*)&enc_ctx->channel_layout,
sizeof(enc_ctx->channel_layout), AV_OPT_SEARCH_CHILDREN);
av_channel_layout_describe(&enc_ctx->ch_layout, buf, sizeof(buf));
ret = av_opt_set(buffersink_ctx, "ch_layouts",
buf, AV_OPT_SEARCH_CHILDREN);
if (ret < 0) {
av_log(NULL, AV_LOG_ERROR, "Cannot set output channel layout\n");
goto end;

View File

@ -105,7 +105,7 @@ int main(int argc, char *argv[])
FILE *fin = NULL, *fout = NULL;
AVFrame *sw_frame = NULL, *hw_frame = NULL;
AVCodecContext *avctx = NULL;
AVCodec *codec = NULL;
const AVCodec *codec = NULL;
const char *enc_name = "h264_vaapi";
if (argc < 5) {

View File

@ -62,7 +62,7 @@ static enum AVPixelFormat get_vaapi_format(AVCodecContext *ctx,
static int open_input_file(const char *filename)
{
int ret;
AVCodec *decoder = NULL;
const AVCodec *decoder = NULL;
AVStream *video = NULL;
if ((ret = avformat_open_input(&ifmt_ctx, filename, NULL, NULL)) < 0) {
@ -142,7 +142,7 @@ end:
return ret;
}
static int dec_enc(AVPacket *pkt, AVCodec *enc_codec)
static int dec_enc(AVPacket *pkt, const AVCodec *enc_codec)
{
AVFrame *frame;
int ret = 0;
@ -226,9 +226,9 @@ fail:
int main(int argc, char **argv)
{
const AVCodec *enc_codec;
int ret = 0;
AVPacket *dec_pkt;
AVCodec *enc_codec;
if (argc != 4) {
fprintf(stderr, "Usage: %s <input file> <encode codec> <output file>\n"

View File

@ -79,6 +79,21 @@ Do not put a '~' character in the samples path to indicate a home
directory. Because of shell nuances, this will cause FATE to fail.
@end float
To get the complete list of tests, run the command:
@example
make fate-list
@end example
You can specify a subset of tests to run by specifying the
corresponding elements from the list with the @code{fate-} prefix,
e.g. as in:
@example
make fate-ffprobe_compact fate-ffprobe_xml
@end example
This makes it easier to run a few tests in case of failure without
running the complete test suite.
To use a custom wrapper to run the test, pass @option{--target-exec} to
@command{configure} or set the @var{TARGET_EXEC} Make variable.

View File

@ -449,6 +449,11 @@ output file already exists.
Set number of times input stream shall be looped. Loop 0 means no loop,
loop -1 means infinite loop.
@item -recast_media (@emph{global})
Allow forcing a decoder of a different media type than the one
detected or designated by the demuxer. Useful for decoding media
data muxed as data streams.
@item -c[:@var{stream_specifier}] @var{codec} (@emph{input/output,per-stream})
@itemx -codec[:@var{stream_specifier}] @var{codec} (@emph{input/output,per-stream})
Select an encoder (when used before an output file) or a decoder (when used
@ -513,6 +518,21 @@ see @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1)
Like the @code{-ss} option but relative to the "end of file". That is negative
values are earlier in the file, 0 is at EOF.
@item -isync @var{input_index} (@emph{input})
Assign an input as a sync source.
This will take the difference between the start times of the target and reference inputs and
offset the timestamps of the target file by that difference. The source timestamps of the two
inputs should derive from the same clock source for expected results. If @code{copyts} is set
then @code{start_at_zero} must also be set. If either of the inputs has no starting timestamp
then no sync adjustment is made.
Acceptable values are those that refer to a valid ffmpeg input index. If the sync reference is
the target index itself or @var{-1}, then no adjustment is made to target timestamps. A sync
reference may not itself be synced to any other input.
Default value is @var{-1}.
@item -itsoffset @var{offset} (@emph{input})
Set the input time offset.
@ -555,27 +575,22 @@ ffmpeg -i INPUT -metadata:s:a:0 language=eng OUTPUT
@item -disposition[:stream_specifier] @var{value} (@emph{output,per-stream})
Sets the disposition for a stream.
This option overrides the disposition copied from the input stream. It is also
possible to delete the disposition by setting it to 0.
By default, the disposition is copied from the input stream, unless the output
stream this option applies to is fed by a complex filtergraph - in that case the
disposition is unset by default.
The following dispositions are recognized:
@table @option
@item default
@item dub
@item original
@item comment
@item lyrics
@item karaoke
@item forced
@item hearing_impaired
@item visual_impaired
@item clean_effects
@item attached_pic
@item captions
@item descriptions
@item dependent
@item metadata
@end table
@var{value} is a sequence of items separated by '+' or '-'. The first item may
also be prefixed with '+' or '-', in which case this option modifies the default
value. Otherwise (the first item is not prefixed) this options overrides the
default value. A '+' prefix adds the given disposition, '-' removes it. It is
also possible to clear the disposition by setting it to 0.
If no @code{-disposition} options were specified for an output file, ffmpeg will
automatically set the 'default' disposition on the first stream of each type,
when there are multiple streams of this type in the output file and no stream of
that type is already marked as default.
The @code{-dispositions} option lists the known dispositions.
For example, to make the second audio stream the default stream:
@example
@ -624,21 +639,21 @@ The parameters set for each target are as follows.
@var{pal}:
-f vcd -muxrate 1411200 -muxpreload 0.44 -packetsize 2324
-s 352x288 -r 25
-codec:v mpeg1video -g 15 -b:v 1150k -maxrate:v 1150v -minrate:v 1150k -bufsize:v 327680
-codec:v mpeg1video -g 15 -b:v 1150k -maxrate:v 1150k -minrate:v 1150k -bufsize:v 327680
-ar 44100 -ac 2
-codec:a mp2 -b:a 224k
@var{ntsc}:
-f vcd -muxrate 1411200 -muxpreload 0.44 -packetsize 2324
-s 352x240 -r 30000/1001
-codec:v mpeg1video -g 18 -b:v 1150k -maxrate:v 1150v -minrate:v 1150k -bufsize:v 327680
-codec:v mpeg1video -g 18 -b:v 1150k -maxrate:v 1150k -minrate:v 1150k -bufsize:v 327680
-ar 44100 -ac 2
-codec:a mp2 -b:a 224k
@var{film}:
-f vcd -muxrate 1411200 -muxpreload 0.44 -packetsize 2324
-s 352x240 -r 24000/1001
-codec:v mpeg1video -g 18 -b:v 1150k -maxrate:v 1150v -minrate:v 1150k -bufsize:v 327680
-codec:v mpeg1video -g 18 -b:v 1150k -maxrate:v 1150k -minrate:v 1150k -bufsize:v 327680
-ar 44100 -ac 2
-codec:a mp2 -b:a 224k
@end example
@ -759,6 +774,16 @@ This option is similar to @option{-filter}, the only difference is that its
argument is the name of the file from which a filtergraph description is to be
read.
@item -reinit_filter[:@var{stream_specifier}] @var{integer} (@emph{input,per-stream})
This boolean option determines if the filtergraph(s) to which this stream is fed gets
reinitialized when input frame parameters change mid-stream. This option is enabled by
default as most video and all audio filters cannot handle deviation in input frame properties.
Upon reinitialization, existing filter state is lost, like e.g. the frame count @code{n}
reference available in some filters. Any frames buffered at time of reinitialization are lost.
The properties where a change triggers reinitialization are,
for video, frame resolution or pixel format;
for audio, sample format, sample rate, channel count or channel layout.
@item -filter_threads @var{nb_threads} (@emph{global})
Defines how many threads are used to process a filter pipeline. Each pipeline
will produce a thread pool with this many threads available for parallel processing.
@ -996,6 +1021,7 @@ Deprecated see -bsf
@item -force_key_frames[:@var{stream_specifier}] @var{time}[,@var{time}...] (@emph{output,per-stream})
@item -force_key_frames[:@var{stream_specifier}] expr:@var{expr} (@emph{output,per-stream})
@item -force_key_frames[:@var{stream_specifier}] source (@emph{output,per-stream})
@item -force_key_frames[:@var{stream_specifier}] source_no_drop (@emph{output,per-stream})
@var{force_key_frames} can take arguments of the following form:
@ -1057,6 +1083,12 @@ starting from second 13:
If the argument is @code{source}, ffmpeg will force a key frame if
the current frame being encoded is marked as a key frame in its source.
@item source_no_drop
If the argument is @code{source_no_drop}, ffmpeg will force a key frame if
the current frame being encoded is marked as a key frame in its source.
In cases where this particular source frame has to be dropped,
enforce the next available frame to become a key frame instead.
@end table
Note that forcing too many keyframes is very harmful for the lookahead
@ -1079,9 +1111,27 @@ device type:
@item cuda
@var{device} is the number of the CUDA device.
The following options are recognized:
@table @option
@item primary_ctx
If set to 1, uses the primary device context instead of creating a new one.
@end table
Examples:
@table @emph
@item -init_hw_device cuda:1
Choose the second device on the system.
@item -init_hw_device cuda:0,primary_ctx=1
Choose the first device and use the primary device context.
@end table
@item dxva2
@var{device} is the number of the Direct3D 9 display adapter.
@item d3d11va
@var{device} is the number of the Direct3D 11 display adapter.
@item vaapi
@var{device} is either an X11 display name or a DRM render node.
If not specified, it will attempt to open the default X11 display (@emph{$DISPLAY})
@ -1105,9 +1155,21 @@ If not specified, it will attempt to open the default X11 display (@emph{$DISPLA
@end table
If not specified, @samp{auto_any} is used.
(Note that it may be easier to achieve the desired result for QSV by creating the
platform-appropriate subdevice (@samp{dxva2} or @samp{vaapi}) and then deriving a
platform-appropriate subdevice (@samp{dxva2} or @samp{d3d11va} or @samp{vaapi}) and then deriving a
QSV device from that.)
Alternatively, @samp{child_device_type} helps to choose platform-appropriate subdevice type.
On Windows @samp{d3d11va} is used as default subdevice type.
Examples:
@table @emph
@item -init_hw_device qsv:hw,child_device_type=d3d11va
Choose the GPU subdevice with type @samp{d3d11va} and create QSV device with @samp{MFX_IMPL_HARDWARE}.
@item -init_hw_device qsv:hw,child_device_type=dxva2
Choose the GPU subdevice with type @samp{dxva2} and create QSV device with @samp{MFX_IMPL_HARDWARE}.
@end table
@item opencl
@var{device} selects the platform and device as @emph{platform_index.device_index}.
@ -1210,6 +1272,9 @@ Use VDPAU (Video Decode and Presentation API for Unix) hardware acceleration.
@item dxva2
Use DXVA2 (DirectX Video Acceleration) hardware acceleration.
@item d3d11va
Use D3D11VA (DirectX Video Acceleration) hardware acceleration.
@item vaapi
Use VAAPI (Video Acceleration API) hardware acceleration.
@ -1243,7 +1308,9 @@ by name, or it can create a new device as if
were called immediately before.
@item -hwaccels
List all hardware acceleration methods supported in this build of ffmpeg.
List all hardware acceleration components enabled in this build of ffmpeg.
Actual runtime availability depends on the hardware and its suitable driver
being installed.
@end table
@ -1551,33 +1618,44 @@ Exit after ffmpeg has been running for @var{duration} seconds in CPU user time.
Dump each input packet to stderr.
@item -hex (@emph{global})
When dumping packets, also dump the payload.
@item -readrate @var{speed} (@emph{input})
Limit input read speed.
Its value is a floating-point positive number which represents the maximum duration of
media, in seconds, that should be ingested in one second of wallclock time.
Default value is zero and represents no imposed limitation on speed of ingestion.
Value @code{1} represents real-time speed and is equivalent to @code{-re}.
Mainly used to simulate a capture device or live input stream (e.g. when reading from a file).
Should not be used with a low value when input is an actual capture device or live stream as
it may cause packet loss.
It is useful for when flow speed of output packets is important, such as live streaming.
@item -re (@emph{input})
Read input at native frame rate. Mainly used to simulate a grab device,
or live input stream (e.g. when reading from a file). Should not be used
with actual grab devices or live input streams (where it can cause packet
loss).
By default @command{ffmpeg} attempts to read the input(s) as fast as possible.
This option will slow down the reading of the input(s) to the native frame rate
of the input(s). It is useful for real-time output (e.g. live streaming).
@item -vsync @var{parameter}
Video sync method.
For compatibility reasons old values can be specified as numbers.
Newly added values will have to be specified as strings always.
Read input at native frame rate. This is equivalent to setting @code{-readrate 1}.
@item -vsync @var{parameter} (@emph{global})
@itemx -fps_mode[:@var{stream_specifier}] @var{parameter} (@emph{output,per-stream})
Set video sync method / framerate mode. vsync is applied to all output video streams
but can be overridden for a stream by setting fps_mode. vsync is deprecated and will be
removed in the future.
For compatibility reasons some of the values for vsync can be specified as numbers (shown
in parentheses in the following table).
@table @option
@item 0, passthrough
@item passthrough (0)
Each frame is passed with its timestamp from the demuxer to the muxer.
@item 1, cfr
@item cfr (1)
Frames will be duplicated and dropped to achieve exactly the requested
constant frame rate.
@item 2, vfr
@item vfr (2)
Frames are passed through with their timestamp or dropped so as to
prevent 2 frames from having the same timestamp.
@item drop
As passthrough but destroys all timestamps, making the muxer generate
fresh timestamps based on frame-rate.
@item -1, auto
Chooses between 1 and 2 depending on muxer capabilities. This is the
@item auto (-1)
Chooses between cfr and vfr depending on muxer capabilities. This is the
default method.
@end table
@ -1686,7 +1764,7 @@ Default value is 0.
@item -bitexact (@emph{input/output})
Enable bitexact mode for (de)muxer and (de/en)coder
@item -shortest (@emph{output})
Finish encoding when the shortest input stream ends.
Finish encoding when the shortest output stream ends.
@item -dts_delta_threshold
Timestamp discontinuity delta threshold.
@item -dts_error_threshold @var{seconds}
@ -1826,7 +1904,7 @@ This option sets the maximum number of queued packets when reading from the
file or device. With low latency / high rate live streams, packets may be
discarded if they are not read in a timely manner; setting this value can
force ffmpeg to use a separate input thread and read packets as soon as they
arrive. By default ffmpeg only do this if multiple inputs are specified.
arrive. By default ffmpeg only does this if multiple inputs are specified.
@item -sdp_file @var{file} (@emph{global})
Print sdp information for an output stream to @var{file}.
@ -1901,6 +1979,13 @@ filter (scale, aresample) in the graph.
On by default, to explicitly disable it you need to specify
@code{-noauto_conversion_filters}.
@item -bits_per_raw_sample[:@var{stream_specifier}] @var{value} (@emph{output,per-stream})
Declare the number of bits per raw sample in the given output stream to be
@var{value}. Note that this option sets the information provided to the
encoder/muxer, it does not change the stream to conform to this value. Setting
values that do not match the stream properties may result in encoding failures
or invalid output files.
@end table
@section Preset files

View File

@ -34,10 +34,6 @@ various FFmpeg APIs.
Force displayed width.
@item -y @var{height}
Force displayed height.
@item -s @var{size}
Set frame size (WxH or abbreviation), needed for videos which do
not contain a header with the frame size like raw YUV. This option
has been deprecated in favor of private options, try -video_size.
@item -fs
Start in fullscreen mode.
@item -an
@ -126,10 +122,6 @@ Read @var{input_url}.
@section Advanced options
@table @option
@item -pix_fmt @var{format}
Set pixel format.
This option has been deprecated in favor of private options, try -pixel_format.
@item -stats
Print several playback statistics, in particular show the stream
duration, the codec parameters, the current position in the stream and
@ -222,8 +214,6 @@ Pause.
Toggle mute.
@item 9, 0
Decrease and increase volume respectively.
@item /, *
Decrease and increase volume respectively.

View File

@ -12,7 +12,7 @@
@chapter Synopsis
ffprobe [@var{options}] [@file{input_url}]
ffprobe [@var{options}] @file{input_url}
@chapter Description
@c man begin DESCRIPTION
@ -28,6 +28,9 @@ If a url is specified in input, ffprobe will try to open and
probe the url content. If the url cannot be opened or recognized as
a multimedia file, a positive exit code is returned.
If no output is specified as output with @option{o} ffprobe will write
to stdout.
ffprobe may be employed both as a standalone application or in
combination with a textual filter, which may perform more
sophisticated processing, e.g. statistical processing or plotting.
@ -335,6 +338,12 @@ Show information about all pixel formats supported by FFmpeg.
Pixel format information for each format is printed within a section
with name "PIXEL_FORMAT".
@item -show_optional_fields @var{value}
Some writers viz. JSON and XML, omit the printing of fields with invalid or non-applicable values,
while other writers always print them. This option enables one to control this behaviour.
Valid values are @code{always}/@code{1}, @code{never}/@code{0} and @code{auto}/@code{-1}.
Default is @var{auto}.
@item -bitexact
Force bitexact output, useful to produce output which is not dependent
on the specific build.
@ -342,6 +351,10 @@ on the specific build.
@item -i @var{input_url}
Read @var{input_url}.
@item -o @var{output_url}
Write output to @var{output_url}. If not specified, the output is sent
to stdout.
@end table
@c man end

View File

@ -29,22 +29,18 @@
</xsd:complexType>
<xsd:complexType name="framesType">
<xsd:sequence>
<xsd:choice minOccurs="0" maxOccurs="unbounded">
<xsd:element name="frame" type="ffprobe:frameType" minOccurs="0" maxOccurs="unbounded"/>
<xsd:element name="subtitle" type="ffprobe:subtitleType" minOccurs="0" maxOccurs="unbounded"/>
</xsd:choice>
</xsd:sequence>
<xsd:choice minOccurs="0" maxOccurs="unbounded">
<xsd:element name="frame" type="ffprobe:frameType"/>
<xsd:element name="subtitle" type="ffprobe:subtitleType"/>
</xsd:choice>
</xsd:complexType>
<xsd:complexType name="packetsAndFramesType">
<xsd:sequence>
<xsd:choice minOccurs="0" maxOccurs="unbounded">
<xsd:element name="packet" type="ffprobe:packetType" minOccurs="0" maxOccurs="unbounded"/>
<xsd:element name="frame" type="ffprobe:frameType" minOccurs="0" maxOccurs="unbounded"/>
<xsd:element name="subtitle" type="ffprobe:subtitleType" minOccurs="0" maxOccurs="unbounded"/>
</xsd:choice>
</xsd:sequence>
<xsd:choice minOccurs="0" maxOccurs="unbounded">
<xsd:element name="packet" type="ffprobe:packetType"/>
<xsd:element name="frame" type="ffprobe:frameType"/>
<xsd:element name="subtitle" type="ffprobe:subtitleType"/>
</xsd:choice>
</xsd:complexType>
<xsd:complexType name="packetType">
@ -90,8 +86,6 @@
<xsd:attribute name="key_frame" type="xsd:int" use="required"/>
<xsd:attribute name="pts" type="xsd:long" />
<xsd:attribute name="pts_time" type="xsd:float"/>
<xsd:attribute name="pkt_pts" type="xsd:long" />
<xsd:attribute name="pkt_pts_time" type="xsd:float"/>
<xsd:attribute name="pkt_dts" type="xsd:long" />
<xsd:attribute name="pkt_dts_time" type="xsd:float"/>
<xsd:attribute name="best_effort_timestamp" type="xsd:long" />
@ -199,6 +193,11 @@
<xsd:attribute name="clean_effects" type="xsd:int" use="required" />
<xsd:attribute name="attached_pic" type="xsd:int" use="required" />
<xsd:attribute name="timed_thumbnails" type="xsd:int" use="required" />
<xsd:attribute name="captions" type="xsd:int" use="required" />
<xsd:attribute name="descriptions" type="xsd:int" use="required" />
<xsd:attribute name="metadata" type="xsd:int" use="required" />
<xsd:attribute name="dependent" type="xsd:int" use="required" />
<xsd:attribute name="still_image" type="xsd:int" use="required" />
</xsd:complexType>
<xsd:complexType name="streamType">
@ -216,6 +215,7 @@
<xsd:attribute name="codec_tag" type="xsd:string" use="required"/>
<xsd:attribute name="codec_tag_string" type="xsd:string" use="required"/>
<xsd:attribute name="extradata" type="xsd:string" />
<xsd:attribute name="extradata_size" type="xsd:int" />
<xsd:attribute name="extradata_hash" type="xsd:string" />
<!-- video attributes -->
@ -224,6 +224,7 @@
<xsd:attribute name="coded_width" type="xsd:int"/>
<xsd:attribute name="coded_height" type="xsd:int"/>
<xsd:attribute name="closed_captions" type="xsd:boolean"/>
<xsd:attribute name="film_grain" type="xsd:boolean"/>
<xsd:attribute name="has_b_frames" type="xsd:int"/>
<xsd:attribute name="sample_aspect_ratio" type="xsd:string"/>
<xsd:attribute name="display_aspect_ratio" type="xsd:string"/>
@ -269,10 +270,6 @@
<xsd:attribute name="program_id" type="xsd:int" use="required"/>
<xsd:attribute name="program_num" type="xsd:int" use="required"/>
<xsd:attribute name="nb_streams" type="xsd:int" use="required"/>
<xsd:attribute name="start_time" type="xsd:float"/>
<xsd:attribute name="start_pts" type="xsd:long"/>
<xsd:attribute name="end_time" type="xsd:float"/>
<xsd:attribute name="end_pts" type="xsd:long"/>
<xsd:attribute name="pmt_pid" type="xsd:int" use="required"/>
<xsd:attribute name="pcr_pid" type="xsd:int" use="required"/>
</xsd:complexType>

View File

@ -167,6 +167,9 @@ Show available sample formats.
@item -layouts
Show channel names and standard channel layouts.
@item -dispositions
Show stream dispositions.
@item -colors
Show recognized color names.
@ -353,6 +356,13 @@ Possible flags for this option are:
@end table
@end table
@item -cpucount @var{count} (@emph{global})
Override detection of CPU count. This option is intended
for testing. Do not use it unless you know what you're doing.
@example
ffmpeg -cpucount 2
@end example
@item -max_alloc @var{bytes}
Set the maximum size limit for allocating a block on the heap by ffmpeg's
family of malloc functions. Exercise @strong{extreme caution} when using

File diff suppressed because it is too large Load Diff

View File

@ -49,7 +49,6 @@ Generate missing PTS if DTS is present.
Ignore DTS if PTS is set. Inert when nofillin is set.
@item ignidx
Ignore index.
@item keepside (@emph{deprecated},@emph{inert})
@item nobuffer
Reduce the latency introduced by buffering during initial input streams analysis.
@item nofillin
@ -70,7 +69,6 @@ This ensures that file and data checksums are reproducible and match between
platforms. Its primary use is for regression testing.
@item flush_packets
Write out packets immediately.
@item latm (@emph{deprecated},@emph{inert})
@item shortest
Stop muxing at the end of the shortest stream.
It may be needed to increase max_interleave_delta to avoid flushing the longer

View File

@ -171,6 +171,13 @@ Go to @url{https://github.com/TimothyGu/libilbc} and follow the instructions for
installing the library. Then pass @code{--enable-libilbc} to configure to
enable it.
@section libjxl
JPEG XL is an image format intended to fully replace legacy JPEG for an extended
period of life. See @url{https://jpegxl.info/} for more information, and see
@url{https://github.com/libjxl/libjxl} for the library source. You can pass
@code{--enable-libjxl} to configure in order enable the libjxl wrapper.
@section libvpx
FFmpeg can make use of the libvpx library for VP8/VP9 decoding and encoding.
@ -263,7 +270,7 @@ to @file{./configure}.
FFmpeg can make use of the Scalable Video Technology for AV1 library for AV1 encoding.
Go to @url{https://github.com/OpenVisualCloud/SVT-AV1/} and follow the instructions
Go to @url{https://gitlab.com/AOMediaCodec/SVT-AV1/} and follow the instructions
for installing the library. Then pass @code{--enable-libsvtav1} to configure to
enable it.
@ -578,6 +585,7 @@ library:
@item raw aptX @tab X @tab X
@item raw aptX HD @tab X @tab X
@item raw Chinese AVS video @tab X @tab X
@item raw DFPWM @tab X @tab X
@item raw Dirac @tab X @tab X
@item raw DNxHD @tab X @tab X
@item raw DTS @tab X @tab X
@ -599,6 +607,7 @@ library:
@item raw NULL @tab X @tab
@item raw video @tab X @tab X
@item raw id RoQ @tab X @tab
@item raw OBU @tab X @tab X
@item raw SBC @tab X @tab X
@item raw Shorten @tab @tab X
@item raw TAK @tab @tab X
@ -695,7 +704,7 @@ library:
@item Windows Televison (WTV) @tab X @tab X
@item Wing Commander III movie @tab @tab X
@tab Multimedia format used in Origin's Wing Commander III computer game.
@item Westwood Studios audio @tab @tab X
@item Westwood Studios audio @tab X @tab X
@tab Multimedia format used in Westwood Studios games.
@item Westwood Studios VQA @tab @tab X
@tab Multimedia format used in Westwood Studios games.
@ -740,6 +749,8 @@ following image formats are supported:
@tab OpenEXR
@item FITS @tab X @tab X
@tab Flexible Image Transport System
@item IMG @tab @tab X
@tab GEM Raster image
@item JPEG @tab X @tab X
@tab Progressive JPEG is not supported.
@item JPEG 2000 @tab X @tab X
@ -764,6 +775,8 @@ following image formats are supported:
@tab PGM with U and V components in YUV 4:2:0
@item PGX @tab @tab X
@tab PGX file decoder
@item PHM @tab X @tab X
@tab Portable HalfFloatMap image
@item PIC @tab @tab X
@tab Pictor/PC Paint
@item PNG @tab X @tab X
@ -774,6 +787,8 @@ following image formats are supported:
@tab Photoshop
@item PTX @tab @tab X
@tab V.Flash PTX format
@item QOI @tab X @tab X
@tab Quite OK Image format
@item SGI @tab X @tab X
@tab SGI RGB image format
@item Sun Rasterfile @tab X @tab X
@ -782,6 +797,8 @@ following image formats are supported:
@tab YUV, JPEG and some extension is not supported yet.
@item Truevision Targa @tab X @tab X
@tab Targa (.TGA) image format
@item VBN @tab X @tab X
@tab Vizrt Binary Image format
@item WebP @tab E @tab X
@tab WebP image format, encoding supported through external library libwebp
@item XBM @tab X @tab X
@ -1018,7 +1035,7 @@ following image formats are supported:
@item QuickTime 8BPS video @tab @tab X
@item QuickTime Animation (RLE) video @tab X @tab X
@tab fourcc: 'rle '
@item QuickTime Graphics (SMC) @tab @tab X
@item QuickTime Graphics (SMC) @tab X @tab X
@tab fourcc: 'smc '
@item QuickTime video (RPZA) @tab X @tab X
@tab fourcc: rpza
@ -1126,6 +1143,7 @@ following image formats are supported:
@item ADPCM Electronic Arts XAS @tab @tab X
@item ADPCM G.722 @tab X @tab X
@item ADPCM G.726 @tab X @tab X
@item ADPCM IMA Acorn Replay @tab @tab X
@item ADPCM IMA AMV @tab X @tab X
@tab Used in AMV files
@item ADPCM IMA Cunning Developments @tab @tab X
@ -1162,7 +1180,7 @@ following image formats are supported:
@item ADPCM Sound Blaster Pro 4-bit @tab @tab X
@item ADPCM VIMA @tab @tab X
@tab Used in LucasArts SMUSH animations.
@item ADPCM Westwood Studios IMA @tab @tab X
@item ADPCM Westwood Studios IMA @tab X @tab X
@tab Used in Westwood Studios games like Command and Conquer.
@item ADPCM Yamaha @tab X @tab X
@item ADPCM Zork @tab @tab X
@ -1190,6 +1208,7 @@ following image formats are supported:
@item CRI HCA @tab @tab X
@item Delphine Software International CIN audio @tab @tab X
@tab Codec used in Delphine Software International games.
@item DFPWM @tab X @tab X
@item Digital Speech Standard - Standard Play mode (DSS SP) @tab @tab X
@item Discworld II BMV Audio @tab @tab X
@item COOK @tab @tab X
@ -1227,7 +1246,7 @@ following image formats are supported:
@item GSM Microsoft variant @tab E @tab X
@tab encoding supported through external library libgsm
@item IAC (Indeo Audio Coder) @tab @tab X
@item iLBC (Internet Low Bitrate Codec) @tab E @tab E
@item iLBC (Internet Low Bitrate Codec) @tab E @tab EX
@tab encoding and decoding supported through external library libilbc
@item IMC (Intel Music Coder) @tab @tab X
@item Interplay ACM @tab @tab X
@ -1299,7 +1318,7 @@ following image formats are supported:
@tab experimental codec
@item Sonic lossless @tab X @tab X
@tab experimental codec
@item Speex @tab E @tab E
@item Speex @tab E @tab EX
@tab supported through external library libspeex
@item TAK (Tom's lossless Audio Kompressor) @tab @tab X
@item True Audio (TTA) @tab X @tab X

View File

@ -53,7 +53,7 @@ Most distribution and operating system provide a package for it.
@section Cloning the source tree
@example
git clone git://source.ffmpeg.org/ffmpeg <target>
git clone https://git.ffmpeg.org/ffmpeg.git <target>
@end example
This will put the FFmpeg sources into the directory @var{<target>}.
@ -187,11 +187,18 @@ to make sure you don't have untracked files or deletions.
git add [-i|-p|-A] <filenames/dirnames>
@end example
Make sure you have told Git your name and email address
Make sure you have told Git your name, email address and GPG key
@example
git config --global user.name "My Name"
git config --global user.email my@@email.invalid
git config --global user.signingkey ABCDEF0123245
@end example
Enable signing all commits or use -S
@example
git config --global commit.gpgsign true
@end example
Use @option{--global} to set the global configuration for all your Git checkouts.
@ -217,16 +224,46 @@ git config --global core.editor
or set by one of the following environment variables:
@var{GIT_EDITOR}, @var{VISUAL} or @var{EDITOR}.
Log messages should be concise but descriptive. Explain why you made a change,
what you did will be obvious from the changes themselves most of the time.
Saying just "bug fix" or "10l" is bad. Remember that people of varying skill
levels look at and educate themselves while reading through your code. Don't
include filenames in log messages, Git provides that information.
@section Writing a commit message
Possibly make the commit message have a terse, descriptive first line, an
empty line and then a full description. The first line will be used to name
Log messages should be concise but descriptive.
The first line must contain the context, a colon and a very short
summary of what the commit does. Details can be added, if necessary,
separated by an empty line. These details should not exceed 60-72 characters
per line, except when containing code.
Example of a good commit message:
@example
avcodec/cbs: add a helper to read extradata within packet side data
Using ff_cbs_read() on the raw buffer will not parse it as extradata,
resulting in parsing errors for example when handling ISOBMFF avcC.
This helper works around that.
@end example
@example
ptr might be NULL
@end example
If the summary on the first line is not enough, in the body of the message,
explain why you made a change, what you did will be obvious from the changes
themselves most of the time. Saying just "bug fix" or "10l" is bad. Remember
that people of varying skill levels look at and educate themselves while
reading through your code. Don't include filenames in log messages except in
the context, Git provides that information.
If the commit fixes a registered issue, state it in a separate line of the
body: @code{Fix Trac ticket #42.}
The first line will be used to name
the patch by @command{git format-patch}.
Common mistakes for the first line, as seen in @command{git log --oneline}
include: missing context at the beginning; description of what the code did
before the patch; line too long or wrapped to the second line.
@section Preparing a patchset
@example
@ -393,6 +430,19 @@ git checkout -b svn_23456 $SHA1
where @var{$SHA1} is the commit hash from the @command{git log} output.
@chapter gpg key generation
If you have no gpg key yet, we recommend that you create a ed25519 based key as it
is small, fast and secure. Especially it results in small signatures in git.
@example
gpg --default-new-key-algo "ed25519/cert,sign+cv25519/encr" --quick-generate-key "human@@server.com"
@end example
When generating a key, make sure the email specified matches the email used in git as some sites like
github consider mismatches a reason to declare such commits unverified. After generating a key you
can add it to the MAINTAINER file and upload it to a keyserver.
@chapter Pre-push checklist
Once you have a set of commits that you feel are ready for pushing,

View File

@ -344,9 +344,23 @@ Defines number of audio channels to capture. Must be @samp{2}, @samp{8} or @samp
Defaults to @samp{2}.
@item duplex_mode
Sets the decklink device duplex mode. Must be @samp{unset}, @samp{half} or @samp{full}.
Sets the decklink device duplex/profile mode. Must be @samp{unset}, @samp{half}, @samp{full},
@samp{one_sub_device_full}, @samp{one_sub_device_half}, @samp{two_sub_device_full},
@samp{four_sub_device_half}
Defaults to @samp{unset}.
Note: DeckLink SDK 11.0 have replaced the duplex property by a profile property.
For the DeckLink Duo 2 and DeckLink Quad 2, a profile is shared between any 2
sub-devices that utilize the same connectors. For the DeckLink 8K Pro, a profile
is shared between all 4 sub-devices. So DeckLink 8K Pro support four profiles.
Valid profile modes for DeckLink 8K Pro(with DeckLink SDK >= 11.0):
@samp{one_sub_device_full}, @samp{one_sub_device_half}, @samp{two_sub_device_full},
@samp{four_sub_device_half}
Valid profile modes for DeckLink Quad 2 and DeckLink Duo 2:
@samp{half}, @samp{full}
@item timecode_format
Timecode type to include in the frame and video stream metadata. Must be
@samp{none}, @samp{rp188vitc}, @samp{rp188vitc2}, @samp{rp188ltc},
@ -611,6 +625,12 @@ Save the currently used video capture filter device and its
parameters (if the filter supports it) to a file.
If a file with the same name exists it will be overwritten.
@item use_video_device_timestamps
If set to @option{false}, the timestamp for video frames will be
derived from the wallclock instead of the timestamp provided by
the capture device. This allows working around devices that
provide unreliable timestamps.
@end table
@subsection Examples
@ -1269,11 +1289,11 @@ Specify the samplerate in Hz, by default 48kHz is used.
Specify the channels in use, by default 2 (stereo) is set.
@item frame_size
Specify the number of bytes per frame, by default it is set to 1024.
This option does nothing and is deprecated.
@item fragment_size
Specify the minimal buffering fragment in PulseAudio, it will affect the
audio latency. By default it is unset.
Specify the size in bytes of the minimal buffering fragment in PulseAudio, it
will affect the audio latency. By default it is set to 50 ms amount of data.
@item wallclock
Set the initial PTS using the current time. Default is 1.

View File

@ -116,7 +116,7 @@ or is abusive towards others).
@section How long does it take for my message in the moderation queue to be approved?
The queue is not checked on a regular basis. You can ask on the
@t{#ffmpeg-devel} IRC channel on Freenode for someone to approve your message.
@t{#ffmpeg-devel} IRC channel on Libera Chat for someone to approve your message.
@anchor{How do I delete my message in the moderation queue?}
@section How do I delete my message in the moderation queue?
@ -155,7 +155,7 @@ Perform a site search using your favorite search engine. Example:
@section Is there an alternative to the mailing list?
You can ask for help in the official @t{#ffmpeg} IRC channel on Freenode.
You can ask for help in the official @t{#ffmpeg} IRC channel on Libera Chat.
Some users prefer the third-party @url{http://www.ffmpeg-archive.org/, Nabble}
interface which presents the mailing lists in a typical forum layout.

View File

@ -19,6 +19,33 @@ enabled demuxers and muxers.
A description of some of the currently available muxers follows.
@anchor{a64}
@section a64
A64 muxer for Commodore 64 video. Accepts a single @code{a64_multi} or @code{a64_multi5} codec video stream.
@anchor{adts}
@section adts
Audio Data Transport Stream muxer. It accepts a single AAC stream.
@subsection Options
It accepts the following options:
@table @option
@item write_id3v2 @var{bool}
Enable to write ID3v2.4 tags at the start of the stream. Default is disabled.
@item write_apetag @var{bool}
Enable to write APE tags at the end of the stream. Default is disabled.
@item write_mpeg2 @var{bool}
Enable to set MPEG version bit in the ADTS frame header to 1 which indicates MPEG-2. Default is 0, which indicates MPEG-4.
@end table
@anchor{aiff}
@section aiff
@ -38,6 +65,37 @@ ID3v2.3 and ID3v2.4) are supported. The default is version 4.
@end table
@anchor{alp}
@section alp
Muxer for audio of High Voltage Software's Lego Racers game. It accepts a single ADPCM_IMA_ALP stream
with no more than 2 channels nor a sample rate greater than 44100 Hz.
Extensions: tun, pcm
@subsection Options
It accepts the following options:
@table @option
@item type @var{type}
Set file type.
@table @samp
@item tun
Set file type as music. Must have a sample rate of 22050 Hz.
@item pcm
Set file type as sfx.
@item auto
Set file type as per output file extension. @code{.pcm} results in type @code{pcm} else type @code{tun} is set. @var{(default)}
@end table
@end table
@anchor{asf}
@section asf
@ -173,37 +231,6 @@ and the input video converted to MPEG-2 video, use the command:
ffmpeg -i INPUT -c:a pcm_u8 -c:v mpeg2video -f crc -
@end example
@section flv
Adobe Flash Video Format muxer.
This muxer accepts the following options:
@table @option
@item flvflags @var{flags}
Possible values:
@table @samp
@item aac_seq_header_detect
Place AAC sequence header based on audio stream data.
@item no_sequence_end
Disable sequence end tag.
@item no_metadata
Disable metadata tag.
@item no_duration_filesize
Disable duration and filesize in metadata when they are equal to zero
at the end of stream. (Be used to non-seekable living stream).
@item add_keyframe_index
Used to facilitate seeking; particularly for HTTP pseudo streaming.
@end table
@end table
@anchor{dash}
@section dash
@ -237,8 +264,6 @@ ffmpeg -re -i <input> -map 0 -map 0 -c:a libfdk_aac -c:v libx264 \
@end example
@table @option
@item min_seg_duration @var{microseconds}
This is a deprecated option to set the segment length in microseconds, use @var{seg_duration} instead.
@item seg_duration @var{duration}
Set the segment length in seconds (fractional value can be set). The value is
treated as average segment duration when @var{use_template} is enabled and
@ -337,12 +362,13 @@ Ignore IO errors during open and write. Useful for long-duration runs with netwo
@item lhls @var{lhls}
Enable Low-latency HLS(LHLS). Adds #EXT-X-PREFETCH tag with current segment's URI.
Apple doesn't have an official spec for LHLS. Meanwhile hls.js player folks are
trying to standardize a open LHLS spec. The draft spec is available in https://github.com/video-dev/hlsjs-rfcs/blob/lhls-spec/proposals/0001-lhls.md
This option will also try to comply with the above open spec, till Apple's spec officially supports it.
Applicable only when @var{streaming} and @var{hls_playlist} options are enabled.
hls.js player folks are trying to standardize an open LHLS spec. The draft spec is available in https://github.com/video-dev/hlsjs-rfcs/blob/lhls-spec/proposals/0001-lhls.md
This option tries to comply with the above open spec.
It enables @var{streaming} and @var{hls_playlist} options automatically.
This is an experimental feature.
Note: This is not Apple's version LHLS. See @url{https://datatracker.ietf.org/doc/html/draft-pantos-hls-rfc8216bis}
@item ldash @var{ldash}
Enable Low-latency Dash by constraining the presence and values of some elements.
@ -380,6 +406,137 @@ adjusting playback latency and buffer occupancy during normal playback by client
@end table
@anchor{fifo}
@section fifo
The fifo pseudo-muxer allows the separation of encoding and muxing by using
first-in-first-out queue and running the actual muxer in a separate thread. This
is especially useful in combination with the @ref{tee} muxer and can be used to
send data to several destinations with different reliability/writing speed/latency.
API users should be aware that callback functions (interrupt_callback,
io_open and io_close) used within its AVFormatContext must be thread-safe.
The behavior of the fifo muxer if the queue fills up or if the output fails is
selectable,
@itemize @bullet
@item
output can be transparently restarted with configurable delay between retries
based on real time or time of the processed stream.
@item
encoding can be blocked during temporary failure, or continue transparently
dropping packets in case fifo queue fills up.
@end itemize
@table @option
@item fifo_format
Specify the format name. Useful if it cannot be guessed from the
output name suffix.
@item queue_size
Specify size of the queue (number of packets). Default value is 60.
@item format_opts
Specify format options for the underlying muxer. Muxer options can be specified
as a list of @var{key}=@var{value} pairs separated by ':'.
@item drop_pkts_on_overflow @var{bool}
If set to 1 (true), in case the fifo queue fills up, packets will be dropped
rather than blocking the encoder. This makes it possible to continue streaming without
delaying the input, at the cost of omitting part of the stream. By default
this option is set to 0 (false), so in such cases the encoder will be blocked
until the muxer processes some of the packets and none of them is lost.
@item attempt_recovery @var{bool}
If failure occurs, attempt to recover the output. This is especially useful
when used with network output, since it makes it possible to restart streaming transparently.
By default this option is set to 0 (false).
@item max_recovery_attempts
Sets maximum number of successive unsuccessful recovery attempts after which
the output fails permanently. By default this option is set to 0 (unlimited).
@item recovery_wait_time @var{duration}
Waiting time before the next recovery attempt after previous unsuccessful
recovery attempt. Default value is 5 seconds.
@item recovery_wait_streamtime @var{bool}
If set to 0 (false), the real time is used when waiting for the recovery
attempt (i.e. the recovery will be attempted after at least
recovery_wait_time seconds).
If set to 1 (true), the time of the processed stream is taken into account
instead (i.e. the recovery will be attempted after at least @var{recovery_wait_time}
seconds of the stream is omitted).
By default, this option is set to 0 (false).
@item recover_any_error @var{bool}
If set to 1 (true), recovery will be attempted regardless of type of the error
causing the failure. By default this option is set to 0 (false) and in case of
certain (usually permanent) errors the recovery is not attempted even when
@var{attempt_recovery} is set to 1.
@item restart_with_keyframe @var{bool}
Specify whether to wait for the keyframe after recovering from
queue overflow or failure. This option is set to 0 (false) by default.
@item timeshift @var{duration}
Buffer the specified amount of packets and delay writing the output. Note that
@var{queue_size} must be big enough to store the packets for timeshift. At the
end of the input the fifo buffer is flushed at realtime speed.
@end table
@subsection Examples
@itemize
@item
Stream something to rtmp server, continue processing the stream at real-time
rate even in case of temporary failure (network outage) and attempt to recover
streaming every second indefinitely.
@example
ffmpeg -re -i ... -c:v libx264 -c:a aac -f fifo -fifo_format flv -map 0:v -map 0:a
-drop_pkts_on_overflow 1 -attempt_recovery 1 -recovery_wait_time 1 rtmp://example.com/live/stream_name
@end example
@end itemize
@section flv
Adobe Flash Video Format muxer.
This muxer accepts the following options:
@table @option
@item flvflags @var{flags}
Possible values:
@table @samp
@item aac_seq_header_detect
Place AAC sequence header based on audio stream data.
@item no_sequence_end
Disable sequence end tag.
@item no_metadata
Disable metadata tag.
@item no_duration_filesize
Disable duration and filesize in metadata when they are equal to zero
at the end of stream. (Be used to non-seekable living stream).
@item add_keyframe_index
Used to facilitate seeking; particularly for HTTP pseudo streaming.
@end table
@end table
@anchor{framecrc}
@section framecrc
@ -642,15 +799,7 @@ were recently referenced in the playlist. Default value is 1, meaning segments o
Set output format options using a :-separated list of key=value
parameters. Values containing @code{:} special characters must be
escaped.
@item hls_wrap @var{wrap}
This is a deprecated option, you can use @code{hls_list_size}
and @code{hls_flags delete_segments} instead it
This option is useful to avoid to fill the disk with many segment
files, and limits the maximum number of segment files written to disk
to @var{wrap}.
@code{hls_ts_options} is deprecated, use hls_segment_options instead of it..
@item hls_start_number_source
Start the playlist sequence number (@code{#EXT-X-MEDIA-SEQUENCE}) according to the specified source.
@ -737,9 +886,6 @@ This example will produce the playlists segment file sets:
@file{vs0/file_000.ts}, @file{vs0/file_001.ts}, @file{vs0/file_002.ts}, etc. and
@file{vs1/file_000.ts}, @file{vs1/file_001.ts}, @file{vs1/file_002.ts}, etc.
@item use_localtime
Same as strftime option, will be deprecated.
@item strftime
Use strftime() on @var{filename} to expand the segment filename with localtime.
The segment number is also available in this mode, but to use it, you need to specify second_level_segment_index
@ -757,9 +903,6 @@ ffmpeg -i in.nut -strftime 1 -hls_flags second_level_segment_index -hls_segment_
This example will produce the playlist, @file{out.m3u8}, and segment files:
@file{file-20160215-0001.ts}, @file{file-20160215-0002.ts}, etc.
@item use_localtime_mkdir
Same as strftime_mkdir option, will be deprecated .
@item strftime_mkdir
Used together with -strftime_mkdir, it will create all subdirectories which
is expanded in @var{filename}.
@ -777,6 +920,10 @@ This example will create a directory hierarchy 2016/02/15 (if any of them do not
produce the playlist, @file{out.m3u8}, and segment files:
@file{2016/02/15/file-20160215-1455569023.ts}, @file{2016/02/15/file-20160215-1455569024.ts}, etc.
@item hls_segment_options @var{options_list}
Set output format options using a :-separated list of key=value
parameters. Values containing @code{:} special characters must be
escaped.
@item hls_key_info_file @var{key_info_file}
Use the information in @var{key_info_file} for segment encryption. The first
@ -913,6 +1060,8 @@ and remove the @code{#EXT-X-ENDLIST} from the old segment list.
@item round_durations
Round the duration info in the playlist file segment info to integer
values, instead of using floating point.
If there are no other features requiring higher HLS versions be used,
then this will allow ffmpeg to output a HLS version 2 m3u8.
@item discont_start
Add the @code{#EXT-X-DISCONTINUITY} tag to the playlist, before the
@ -1278,6 +1427,10 @@ overwritten with new images. Default value is 0.
If set to 1, expand the filename with date and time information from
@code{strftime()}. Default value is 0.
@item atomic_writing
Write output to a temporary file, which is renamed to target filename once
writing is completed. Default is disabled.
@item protocol_opts @var{options_list}
Set protocol options as a :-separated list of key=value parameters. Values
containing the @code{:} special character must be escaped.
@ -1416,18 +1569,27 @@ A safe size for most use cases should be about 50kB per hour of video.
Note that cues are only written if the output is seekable and this option will
have no effect if it is not.
@item cues_to_front
If set, the muxer will write the index at the beginning of the file
by shifting the main data if necessary. This can be combined with
reserve_index_space in which case the data is only shifted if
the initially reserved space turns out to be insufficient.
This option is ignored if the output is unseekable.
@item default_mode
This option controls how the FlagDefault of the output tracks will be set.
It influences which tracks players should play by default. The default mode
is @samp{infer}.
is @samp{passthrough}.
@table @samp
@item infer
In this mode, for each type of track (audio, video or subtitle), if there is
a track with disposition default of this type, then the first such track
(i.e. the one with the lowest index) will be marked as default; if no such
track exists, the first track of this type will be marked as default instead
(if existing). This ensures that the default flag is set in a sensible way even
if the input originated from containers that lack the concept of default tracks.
Every track with disposition default will have the FlagDefault set.
Additionally, for each type of track (audio, video or subtitle), if no track
with disposition default of this type exists, then the first track of this type
will be marked as default (if existing). This ensures that the default flag
is set in a sensible way even if the input originated from containers that
lack the concept of default tracks.
@item infer_no_subs
This mode is the same as infer except that if no subtitle track with
disposition default exists, no subtitle track will be marked as default.
@ -1571,6 +1733,14 @@ B-frames. Additionally, eases conformance with the DASH-IF interoperability
guidelines.
This option is implicitly set when writing ismv (Smooth Streaming) files.
@item -write_btrt @var{bool}
Force or disable writing bitrate box inside stsd box of a track.
The box contains decoding buffer size (in bytes), maximum bitrate and
average bitrate for the track. The box will be skipped if none of these values
can be computed.
Default is @code{-1} or @code{auto}, which will write the box only in MP4 mode.
@item -write_prft
Write producer time reference box (PRFT) with a specified time source for the
NTP field in the PRFT box. Set value as @samp{wallclock} to specify timesource
@ -1581,6 +1751,19 @@ Setting value to @samp{pts} is applicable only for a live encoding use case,
where PTS values are set as as wallclock time at the source. For example, an
encoding use case with decklink capture source where @option{video_pts} and
@option{audio_pts} are set to @samp{abs_wallclock}.
@item -empty_hdlr_name @var{bool}
Enable to skip writing the name inside a @code{hdlr} box.
Default is @code{false}.
@item -movie_timescale @var{scale}
Set the timescale written in the movie header box (@code{mvhd}).
Range is 1 to INT_MAX. Default is 1000.
@item -video_track_timescale @var{scale}
Set the timescale used for video tracks. Range is 0 to INT_MAX.
If set to @code{0}, the timescale is automatically set based on
the native stream time base. Default is 0.
@end table
@subsection Example
@ -1730,6 +1913,8 @@ Reemit PAT and PMT at each video frame.
Conform to System B (DVB) instead of System A (ATSC).
@item initial_discontinuity
Mark the initial packet of each stream as discontinuity.
@item nit
Emit NIT table.
@end table
@item mpegts_copyts @var{boolean}
@ -1751,8 +1936,11 @@ Maximum time in seconds between PAT/PMT tables. Default is @code{0.1}.
@item sdt_period @var{duration}
Maximum time in seconds between SDT tables. Default is @code{0.5}.
@item nit_period @var{duration}
Maximum time in seconds between NIT tables. Default is @code{0.5}.
@item tables_version @var{integer}
Set PAT, PMT and SDT version (default @code{0}, valid values are from 0 to 31, inclusively).
Set PAT, PMT, SDT and NIT version (default @code{0}, valid values are from 0 to 31, inclusively).
This option allows updating stream structure so that standard consumer may
detect the change. To do so, reopen output @code{AVFormatContext} (in case of API
usage) or restart @command{ffmpeg} instance, cyclically changing
@ -1864,6 +2052,182 @@ ogg files can be safely chained.
@end table
@anchor{raw muxers}
@section raw muxers
Raw muxers accept a single stream matching the designated codec. They do not store timestamps or metadata.
The recognized extension is the same as the muxer name unless indicated otherwise.
@subsection ac3
Dolby Digital, also known as AC-3, audio.
@subsection adx
CRI Middleware ADX audio.
This muxer will write out the total sample count near the start of the first packet
when the output is seekable and the count can be stored in 32 bits.
@subsection aptx
aptX (Audio Processing Technology for Bluetooth) audio.
@subsection aptx_hd
aptX HD (Audio Processing Technology for Bluetooth) audio.
Extensions: aptxhd
@subsection avs2
AVS2-P2/IEEE1857.4 video.
Extensions: avs, avs2
@subsection cavsvideo
Chinese AVS (Audio Video Standard) video.
Extensions: cavs
@subsection codec2raw
Codec 2 audio.
No extension is registered so format name has to be supplied e.g. with the ffmpeg CLI tool @code{-f codec2raw}.
@subsection data
Data muxer accepts a single stream with any codec of any type.
The input stream has to be selected using the @code{-map} option with the ffmpeg CLI tool.
No extension is registered so format name has to be supplied e.g. with the ffmpeg CLI tool @code{-f data}.
@subsection dirac
BBC Dirac video. The Dirac Pro codec is a subset and is standardized as SMPTE VC-2.
Extensions: drc, vc2
@subsection dnxhd
Avid DNxHD video. It is standardized as SMPTE VC-3. Accepts DNxHR streams.
Extensions: dnxhd, dnxhr
@subsection dts
DTS Coherent Acoustics (DCA) audio.
@subsection eac3
Dolby Digital Plus, also known as Enhanced AC-3, audio.
@subsection g722
ITU-T G.722 audio.
@subsection g723_1
ITU-T G.723.1 audio.
Extensions: tco, rco
@subsection g726
ITU-T G.726 big-endian ("left-justified") audio.
No extension is registered so format name has to be supplied e.g. with the ffmpeg CLI tool @code{-f g726}.
@subsection g726le
ITU-T G.726 little-endian ("right-justified") audio.
No extension is registered so format name has to be supplied e.g. with the ffmpeg CLI tool @code{-f g726le}.
@subsection gsm
Global System for Mobile Communications audio.
@subsection h261
ITU-T H.261 video.
@subsection h263
ITU-T H.263 / H.263-1996, H.263+ / H.263-1998 / H.263 version 2 video.
@subsection h264
ITU-T H.264 / MPEG-4 Part 10 AVC video. Bitstream shall be converted to Annex B syntax if it's in length-prefixed mode.
Extensions: h264, 264
@subsection hevc
ITU-T H.265 / MPEG-H Part 2 HEVC video. Bitstream shall be converted to Annex B syntax if it's in length-prefixed mode.
Extensions: hevc, h265, 265
@subsection m4v
MPEG-4 Part 2 video.
@subsection mjpeg
Motion JPEG video.
Extensions: mjpg, mjpeg
@subsection mlp
Meridian Lossless Packing, also known as Packed PCM, audio.
@subsection mp2
MPEG-1 Audio Layer II audio.
Extensions: mp2, m2a, mpa
@subsection mpeg1video
MPEG-1 Part 2 video.
Extensions: mpg, mpeg, m1v
@subsection mpeg2video
ITU-T H.262 / MPEG-2 Part 2 video.
Extensions: m2v
@subsection obu
AV1 low overhead Open Bitstream Units muxer. Temporal delimiter OBUs will be inserted in all temporal units of the stream.
@subsection rawvideo
Raw uncompressed video.
Extensions: yuv, rgb
@subsection sbc
Bluetooth SIG low-complexity subband codec audio.
Extensions: sbc, msbc
@subsection truehd
Dolby TrueHD audio.
Extensions: thd
@subsection vc1
SMPTE 421M / VC-1 video.
@anchor{segment}
@section segment, stream_segment, ssegment
@ -2232,106 +2596,6 @@ ffmpeg -i INPUT -f streamhash -hash md5 -
See also the @ref{hash} and @ref{framehash} muxers.
@anchor{fifo}
@section fifo
The fifo pseudo-muxer allows the separation of encoding and muxing by using
first-in-first-out queue and running the actual muxer in a separate thread. This
is especially useful in combination with the @ref{tee} muxer and can be used to
send data to several destinations with different reliability/writing speed/latency.
API users should be aware that callback functions (interrupt_callback,
io_open and io_close) used within its AVFormatContext must be thread-safe.
The behavior of the fifo muxer if the queue fills up or if the output fails is
selectable,
@itemize @bullet
@item
output can be transparently restarted with configurable delay between retries
based on real time or time of the processed stream.
@item
encoding can be blocked during temporary failure, or continue transparently
dropping packets in case fifo queue fills up.
@end itemize
@table @option
@item fifo_format
Specify the format name. Useful if it cannot be guessed from the
output name suffix.
@item queue_size
Specify size of the queue (number of packets). Default value is 60.
@item format_opts
Specify format options for the underlying muxer. Muxer options can be specified
as a list of @var{key}=@var{value} pairs separated by ':'.
@item drop_pkts_on_overflow @var{bool}
If set to 1 (true), in case the fifo queue fills up, packets will be dropped
rather than blocking the encoder. This makes it possible to continue streaming without
delaying the input, at the cost of omitting part of the stream. By default
this option is set to 0 (false), so in such cases the encoder will be blocked
until the muxer processes some of the packets and none of them is lost.
@item attempt_recovery @var{bool}
If failure occurs, attempt to recover the output. This is especially useful
when used with network output, since it makes it possible to restart streaming transparently.
By default this option is set to 0 (false).
@item max_recovery_attempts
Sets maximum number of successive unsuccessful recovery attempts after which
the output fails permanently. By default this option is set to 0 (unlimited).
@item recovery_wait_time @var{duration}
Waiting time before the next recovery attempt after previous unsuccessful
recovery attempt. Default value is 5 seconds.
@item recovery_wait_streamtime @var{bool}
If set to 0 (false), the real time is used when waiting for the recovery
attempt (i.e. the recovery will be attempted after at least
recovery_wait_time seconds).
If set to 1 (true), the time of the processed stream is taken into account
instead (i.e. the recovery will be attempted after at least @var{recovery_wait_time}
seconds of the stream is omitted).
By default, this option is set to 0 (false).
@item recover_any_error @var{bool}
If set to 1 (true), recovery will be attempted regardless of type of the error
causing the failure. By default this option is set to 0 (false) and in case of
certain (usually permanent) errors the recovery is not attempted even when
@var{attempt_recovery} is set to 1.
@item restart_with_keyframe @var{bool}
Specify whether to wait for the keyframe after recovering from
queue overflow or failure. This option is set to 0 (false) by default.
@item timeshift @var{duration}
Buffer the specified amount of packets and delay writing the output. Note that
@var{queue_size} must be big enough to store the packets for timeshift. At the
end of the input the fifo buffer is flushed at realtime speed.
@end table
@subsection Examples
@itemize
@item
Stream something to rtmp server, continue processing the stream at real-time
rate even in case of temporary failure (network outage) and attempt to recover
streaming every second indefinitely.
@example
ffmpeg -re -i ... -c:v libx264 -c:a aac -f fifo -fifo_format flv -map 0:v -map 0:a
-drop_pkts_on_overflow 1 -attempt_recovery 1 -recovery_wait_time 1 rtmp://example.com/live/stream_name
@end example
@end itemize
@anchor{tee}
@section tee
@ -2464,6 +2728,49 @@ ffmpeg -i ... -map 0 -flags +global_header -c:v libx264 -c:a aac
@end example
@end itemize
@section webm_chunk
WebM Live Chunk Muxer.
This muxer writes out WebM headers and chunks as separate files which can be
consumed by clients that support WebM Live streams via DASH.
@subsection Options
This muxer supports the following options:
@table @option
@item chunk_start_index
Index of the first chunk (defaults to 0).
@item header
Filename of the header where the initialization data will be written.
@item audio_chunk_duration
Duration of each audio chunk in milliseconds (defaults to 5000).
@end table
@subsection Example
@example
ffmpeg -f v4l2 -i /dev/video0 \
-f alsa -i hw:0 \
-map 0:0 \
-c:v libvpx-vp9 \
-s 640x360 -keyint_min 30 -g 30 \
-f webm_chunk \
-header webm_live_video_360.hdr \
-chunk_start_index 1 \
webm_live_video_360_%d.chk \
-map 1:0 \
-c:a libvorbis \
-b:a 128k \
-f webm_chunk \
-header webm_live_audio_128.hdr \
-chunk_start_index 1 \
-audio_chunk_duration 1000 \
webm_live_audio_128_%d.chk
@end example
@section webm_dash_manifest
WebM DASH Manifest muxer.
@ -2530,47 +2837,4 @@ ffmpeg -f webm_dash_manifest -i video1.webm \
manifest.xml
@end example
@section webm_chunk
WebM Live Chunk Muxer.
This muxer writes out WebM headers and chunks as separate files which can be
consumed by clients that support WebM Live streams via DASH.
@subsection Options
This muxer supports the following options:
@table @option
@item chunk_start_index
Index of the first chunk (defaults to 0).
@item header
Filename of the header where the initialization data will be written.
@item audio_chunk_duration
Duration of each audio chunk in milliseconds (defaults to 5000).
@end table
@subsection Example
@example
ffmpeg -f v4l2 -i /dev/video0 \
-f alsa -i hw:0 \
-map 0:0 \
-c:v libvpx-vp9 \
-s 640x360 -keyint_min 30 -g 30 \
-f webm_chunk \
-header webm_live_video_360.hdr \
-chunk_start_index 1 \
webm_live_video_360_%d.chk \
-map 1:0 \
-c:a libvorbis \
-b:a 128k \
-f webm_chunk \
-header webm_live_audio_128.hdr \
-chunk_start_index 1 \
-audio_chunk_duration 1000 \
webm_live_audio_128_%d.chk
@end example
@c man end MUXERS

View File

@ -198,13 +198,43 @@ Amount of time to preroll video in seconds.
Defaults to @option{0.5}.
@item duplex_mode
Sets the decklink device duplex mode. Must be @samp{unset}, @samp{half} or @samp{full}.
Sets the decklink device duplex/profile mode. Must be @samp{unset}, @samp{half}, @samp{full},
@samp{one_sub_device_full}, @samp{one_sub_device_half}, @samp{two_sub_device_full},
@samp{four_sub_device_half}
Defaults to @samp{unset}.
Note: DeckLink SDK 11.0 have replaced the duplex property by a profile property.
For the DeckLink Duo 2 and DeckLink Quad 2, a profile is shared between any 2
sub-devices that utilize the same connectors. For the DeckLink 8K Pro, a profile
is shared between all 4 sub-devices. So DeckLink 8K Pro support four profiles.
Valid profile modes for DeckLink 8K Pro(with DeckLink SDK >= 11.0):
@samp{one_sub_device_full}, @samp{one_sub_device_half}, @samp{two_sub_device_full},
@samp{four_sub_device_half}
Valid profile modes for DeckLink Quad 2 and DeckLink Duo 2:
@samp{half}, @samp{full}
@item timing_offset
Sets the genlock timing pixel offset on the used output.
Defaults to @samp{unset}.
@item link
Sets the SDI video link configuration on the used output. Must be
@samp{unset}, @samp{single} link SDI, @samp{dual} link SDI or @samp{quad} link
SDI.
Defaults to @samp{unset}.
@item sqd
Enable Square Division Quad Split mode for Quad-link SDI output.
Must be @samp{unset}, @samp{true} or @samp{false}.
Defaults to @option{unset}.
@item level_a
Enable SMPTE Level A mode on the used output.
Must be @samp{unset}, @samp{true} or @samp{false}.
Defaults to @option{unset}.
@end table
@subsection Examples

View File

@ -215,6 +215,38 @@ ffplay concat:split1.mpeg\|split2.mpeg\|split3.mpeg
Note that you may need to escape the character "|" which is special for
many shells.
@section concatf
Physical concatenation protocol using a line break delimited list of
resources.
Read and seek from many resources in sequence as if they were
a unique resource.
A URL accepted by this protocol has the syntax:
@example
concatf:@var{URL}
@end example
where @var{URL} is the url containing a line break delimited list of
resources to be concatenated, each one possibly specifying a distinct
protocol. Special characters must be escaped with backslash or single
quotes. See @ref{quoting_and_escaping,,the "Quoting and escaping"
section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
For example to read a sequence of files @file{split1.mpeg},
@file{split2.mpeg}, @file{split3.mpeg} listed in separate lines within
a file @file{split.txt} with @command{ffplay} use the command:
@example
ffplay concatf:split.txt
@end example
Where @file{split.txt} contains the lines:
@example
split1.mpeg
split2.mpeg
split3.mpeg
@end example
@section crypto
AES-encrypted stream reading protocol.
@ -406,9 +438,6 @@ Set the Referer header. Include 'Referer: URL' header in HTTP request.
Override the User-Agent header. If not specified the protocol will use a
string describing the libavformat build. ("Lavf/<version>")
@item user-agent
This is a deprecated option, you can use user_agent instead it.
@item reconnect_at_eof
If set then eof is treated like an error and causes reconnection, this is useful
for live / endless streams.
@ -585,6 +614,38 @@ Establish a TLS (HTTPS) connection to Icecast.
icecast://[@var{username}[:@var{password}]@@]@var{server}:@var{port}/@var{mountpoint}
@end example
@section ipfs
InterPlanetary File System (IPFS) protocol support. One can access files stored
on the IPFS network through so-called gateways. These are http(s) endpoints.
This protocol wraps the IPFS native protocols (ipfs:// and ipns://) to be sent
to such a gateway. Users can (and should) host their own node which means this
protocol will use one's local gateway to access files on the IPFS network.
If a user doesn't have a node of their own then the public gateway @code{https://dweb.link}
is used by default.
This protocol accepts the following options:
@table @option
@item gateway
Defines the gateway to use. When not set, the protocol will first try
locating the local gateway by looking at @code{$IPFS_GATEWAY}, @code{$IPFS_PATH}
and @code{$HOME/.ipfs/}, in that order. If that fails @code{https://dweb.link} will be used.
@end table
One can use this protocol in 2 ways. Using IPFS:
@example
ffplay ipfs://QmbGtJg23skhvFmu9mJiePVByhfzu5rwo74MEkVDYAmF5T
@end example
Or the IPNS protocol (IPNS is mutable IPFS):
@example
ffplay ipns://QmbGtJg23skhvFmu9mJiePVByhfzu5rwo74MEkVDYAmF5T
@end example
@section mmst
MMS (Microsoft Media Server) protocol over TCP.
@ -716,6 +777,14 @@ Set internal RIST buffer size in milliseconds for retransmission of data.
Default value is 0 which means the librist default (1 sec). Maximum value is 30
seconds.
@item fifo_size
Size of the librist receiver output fifo in number of packets. This must be a
power of 2.
Defaults to 8192 (vs the librist default of 1024).
@item overrun_nonfatal=@var{1|0}
Survive in case of librist fifo buffer overrun. Default value is 0.
@item pkt_size
Set maximum packet size for sending data. 1316 by default.
@ -846,6 +915,11 @@ URL to player swf file, compute hash/size automatically.
@item rtmp_tcurl
URL of the target stream. Defaults to proto://host[:port]/app.
@item tcp_nodelay=@var{1|0}
Set TCP_NODELAY to disable Nagle's algorithm. Default value is 0.
@emph{Remark: Writing to the socket is currently not optimized to minimize system calls and reduces the efficiency / effect of TCP_NODELAY.}
@end table
For example to read with @command{ffplay} a multimedia resource named
@ -1053,6 +1127,10 @@ set to 1) or to a default remote address (if set to 0).
@item localport=@var{n}
Set the local RTP port to @var{n}.
@item localaddr=@var{addr}
Local IP address of a network interface used for sending packets or joining
multicast groups.
@item timeout=@var{n}
Set timeout (in microseconds) of socket I/O operations to @var{n}.
@ -1164,19 +1242,18 @@ Set minimum local UDP port. Default value is 5000.
@item max_port
Set maximum local UDP port. Default value is 65000.
@item timeout
Set maximum timeout (in seconds) to wait for incoming connections.
A value of -1 means infinite (default). This option implies the
@option{rtsp_flags} set to @samp{listen}.
@item listen_timeout
Set maximum timeout (in seconds) to establish an initial connection. Setting
@option{listen_timeout} > 0 sets @option{rtsp_flags} to @samp{listen}. Default is -1
which means an infinite timeout when @samp{listen} mode is set.
@item reorder_queue_size
Set number of packets to buffer for handling of reordered packets.
@item stimeout
@item timeout
Set socket TCP I/O timeout in microseconds.
@item user-agent
@item user_agent
Override User-Agent header. If not specified, it defaults to the
libavformat identifier string.
@end table
@ -1463,6 +1540,12 @@ when the old encryption key is decommissioned. Default is -1.
-1 means auto (0x1000 in srt library). The range for
this option is integers in the 0 - @code{INT_MAX}.
@item snddropdelay=@var{microseconds}
The sender's extra delay before dropping packets. This delay is
added to the default drop delay time interval value.
Special value -1: Do not drop packets on the sender at all.
@item payload_size=@var{bytes}
Sets the maximum declared size of a packet transferred
during the single call to the sending function in Live
@ -1562,6 +1645,9 @@ This option doesnt make sense in Rendezvous connection; the result
might be that simply one side will override the value from the other
side and its the matter of luck which one would win
@item srt_streamid=@var{string}
Alias for @samp{streamid} to avoid conflict with ffmpeg command line option.
@item smoother=@var{live|file}
The type of Smoother used for the transmission for that socket, which
is responsible for the transmission and congestion control. The Smoother
@ -1611,6 +1697,11 @@ Default is -1. -1 means auto (off with 0 seconds in live mode, on with 180
seconds in file mode). The range for this option is integers in the
0 - @code{INT_MAX}.
@item tsbpd=@var{1|0}
When true, use Timestamp-based Packet Delivery mode. The default behavior
depends on the transmission type: enabled in live mode, disabled in file
mode.
@end table
For more information see: @url{https://github.com/Haivision/srt}.
@ -1719,6 +1810,8 @@ Set send buffer size, expressed bytes.
@item tcp_nodelay=@var{1|0}
Set TCP_NODELAY to disable Nagle's algorithm. Default value is 0.
@emph{Remark: Writing to the socket is currently not optimized to minimize system calls and reduces the efficiency / effect of TCP_NODELAY.}
@item tcp_mss=@var{bytes}
Set maximum segment size for outgoing TCP packets, expressed in bytes.
@end table
@ -1972,5 +2065,4 @@ decoding errors.
@end table
@c man end PROTOCOLS

View File

@ -20,8 +20,45 @@
# License along with FFmpeg; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
# Texinfo 7.0 changed the syntax of various functions.
# Provide a shim for older versions.
sub ff_set_from_init_file($$) {
my $key = shift;
my $value = shift;
if (exists &{'texinfo_set_from_init_file'}) {
texinfo_set_from_init_file($key, $value);
} else {
set_from_init_file($key, $value);
}
}
sub ff_get_conf($) {
my $key = shift;
if (exists &{'texinfo_get_conf'}) {
texinfo_get_conf($key);
} else {
get_conf($key);
}
}
sub get_formatting_function($$) {
my $obj = shift;
my $func = shift;
my $sub = $obj->can('formatting_function');
if ($sub) {
return $obj->formatting_function($func);
} else {
return $obj->{$func};
}
}
# determine texinfo version
my $program_version_num = version->declare(ff_get_conf('PACKAGE_VERSION'))->numify;
my $program_version_6_8 = $program_version_num >= 6.008000;
# no navigation elements
set_from_init_file('HEADERS', 0);
ff_set_from_init_file('HEADERS', 0);
sub ffmpeg_heading_command($$$$$)
{
@ -55,7 +92,7 @@ sub ffmpeg_heading_command($$$$$)
$element = $command->{'parent'};
}
if ($element) {
$result .= &{$self->{'format_element_header'}}($self, $cmdname,
$result .= &{get_formatting_function($self, 'format_element_header')}($self, $cmdname,
$command, $element);
}
@ -112,7 +149,11 @@ sub ffmpeg_heading_command($$$$$)
$cmdname
= $Texinfo::Common::level_to_structuring_command{$cmdname}->[$heading_level];
}
$result .= &{$self->{'format_heading_text'}}(
# format_heading_text expects an array of headings for texinfo >= 7.0
if ($program_version_num >= 7.000000) {
$heading = [$heading];
}
$result .= &{get_formatting_function($self,'format_heading_text')}(
$self, $cmdname, $heading,
$heading_level +
$self->get_conf('CHAPTER_HEADER_LEVEL') - 1, $command);
@ -127,14 +168,18 @@ foreach my $command (keys(%Texinfo::Common::sectioning_commands), 'node') {
}
# print the TOC where @contents is used
set_from_init_file('INLINE_CONTENTS', 1);
if ($program_version_6_8) {
ff_set_from_init_file('CONTENTS_OUTPUT_LOCATION', 'inline');
} else {
ff_set_from_init_file('INLINE_CONTENTS', 1);
}
# make chapters <h2>
set_from_init_file('CHAPTER_HEADER_LEVEL', 2);
ff_set_from_init_file('CHAPTER_HEADER_LEVEL', 2);
# Do not add <hr>
set_from_init_file('DEFAULT_RULE', '');
set_from_init_file('BIG_RULE', '');
ff_set_from_init_file('DEFAULT_RULE', '');
ff_set_from_init_file('BIG_RULE', '');
# Customized file beginning
sub ffmpeg_begin_file($$$)
@ -151,7 +196,18 @@ sub ffmpeg_begin_file($$$)
my ($title, $description, $encoding, $date, $css_lines,
$doctype, $bodytext, $copying_comment, $after_body_open,
$extra_head, $program_and_version, $program_homepage,
$program, $generator) = $self->_file_header_informations($command);
$program, $generator);
if ($program_version_num >= 7.000000) {
($title, $description, $encoding, $date, $css_lines,
$doctype, $bodytext, $copying_comment, $after_body_open,
$extra_head, $program_and_version, $program_homepage,
$program, $generator) = $self->_file_header_information($command);
} else {
($title, $description, $encoding, $date, $css_lines,
$doctype, $bodytext, $copying_comment, $after_body_open,
$extra_head, $program_and_version, $program_homepage,
$program, $generator) = $self->_file_header_informations($command);
}
my $links = $self->_get_links ($filename, $element);
@ -184,7 +240,11 @@ EOT
return $head1 . $head_title . $head2 . $head_title . $head3;
}
texinfo_register_formatting_function('begin_file', \&ffmpeg_begin_file);
if ($program_version_6_8) {
texinfo_register_formatting_function('format_begin_file', \&ffmpeg_begin_file);
} else {
texinfo_register_formatting_function('begin_file', \&ffmpeg_begin_file);
}
sub ffmpeg_program_string($)
{
@ -201,13 +261,17 @@ sub ffmpeg_program_string($)
$self->gdt('This document was generated automatically.'));
}
}
texinfo_register_formatting_function('program_string', \&ffmpeg_program_string);
if ($program_version_6_8) {
texinfo_register_formatting_function('format_program_string', \&ffmpeg_program_string);
} else {
texinfo_register_formatting_function('program_string', \&ffmpeg_program_string);
}
# Customized file ending
sub ffmpeg_end_file($)
{
my $self = shift;
my $program_string = &{$self->{'format_program_string'}}($self);
my $program_string = &{get_formatting_function($self,'format_program_string')}($self);
my $program_text = <<EOT;
<p style="font-size: small;">
$program_string
@ -220,11 +284,15 @@ EOT
EOT
return $program_text . $footer;
}
texinfo_register_formatting_function('end_file', \&ffmpeg_end_file);
if ($program_version_6_8) {
texinfo_register_formatting_function('format_end_file', \&ffmpeg_end_file);
} else {
texinfo_register_formatting_function('end_file', \&ffmpeg_end_file);
}
# Dummy title command
# Ignore title. Title is handled through ffmpeg_begin_file().
set_from_init_file('USE_TITLEPAGE_FOR_TITLE', 1);
ff_set_from_init_file('USE_TITLEPAGE_FOR_TITLE', 1);
sub ffmpeg_title($$$$)
{
return '';
@ -242,8 +310,14 @@ sub ffmpeg_float($$$$$)
my $args = shift;
my $content = shift;
my ($caption, $prepended) = Texinfo::Common::float_name_caption($self,
$command);
my ($caption, $prepended);
if ($program_version_num >= 7.000000) {
($caption, $prepended) = Texinfo::Convert::Converter::float_name_caption($self,
$command);
} else {
($caption, $prepended) = Texinfo::Common::float_name_caption($self,
$command);
}
my $caption_text = '';
my $prepended_text;
my $prepended_save = '';
@ -315,8 +389,13 @@ sub ffmpeg_float($$$$$)
$caption->{'args'}->[0], 'float caption');
}
if ($prepended_text.$caption_text ne '') {
$prepended_text = $self->_attribute_class('div','float-caption'). '>'
. $prepended_text;
if ($program_version_num >= 7.000000) {
$prepended_text = $self->html_attribute_class('div',['float-caption']). '>'
. $prepended_text;
} else {
$prepended_text = $self->_attribute_class('div','float-caption'). '>'
. $prepended_text;
}
$caption_text .= '</div>';
}
my $html_class = '';
@ -329,8 +408,13 @@ sub ffmpeg_float($$$$$)
$prepended_text = '';
$caption_text = '';
}
return $self->_attribute_class('div', $html_class). '>' . "\n" .
$prepended_text . $caption_text . $content . '</div>';
if ($program_version_num >= 7.000000) {
return $self->html_attribute_class('div', [$html_class]). '>' . "\n" .
$prepended_text . $caption_text . $content . '</div>';
} else {
return $self->_attribute_class('div', $html_class). '>' . "\n" .
$prepended_text . $caption_text . $content . '</div>';
}
}
texinfo_register_command_formatting('float',

706
doc/transforms.md Normal file
View File

@ -0,0 +1,706 @@
The basis transforms used for FFT and various other derived functions are based
on the following unrollings.
The functions can be easily adapted to double precision floats as well.
# Parity permutation
The basis transforms described here all use the following permutation:
``` C
void ff_tx_gen_split_radix_parity_revtab(int *revtab, int len, int inv,
int basis, int dual_stride);
```
Parity means even and odd complex numbers will be split, e.g. the even
coefficients will come first, after which the odd coefficients will be
placed. For example, a 4-point transform's coefficients after reordering:
`z[0].re, z[0].im, z[2].re, z[2].im, z[1].re, z[1].im, z[3].re, z[3].im`
The basis argument is the length of the largest non-composite transform
supported, and also implies that the basis/2 transform is supported as well,
as the split-radix algorithm requires it to be.
The dual_stride argument indicates that both the basis, as well as the
basis/2 transforms support doing two transforms at once, and the coefficients
will be interleaved between each pair in a split-radix like so (stride == 2):
`tx1[0], tx1[2], tx2[0], tx2[2], tx1[1], tx1[3], tx2[1], tx2[3]`
A non-zero number switches this on, with the value indicating the stride
(how many values of 1 transform to put first before switching to the other).
Must be a power of two or 0. Must be less than the basis.
Value will be clipped to the transform size, so for a basis of 16 and a
dual_stride of 8, dual 8-point transforms will be laid out as if dual_stride
was set to 4.
Usually you'll set this to half the complex numbers that fit in a single
register or 0. This allows to reuse SSE functions as dual-transform
functions in AVX mode.
If length is smaller than basis/2 this function will not do anything.
# 4-point FFT transform
The only permutation this transform needs is to swap the `z[1]` and `z[2]`
elements when performing an inverse transform, which in the assembly code is
hardcoded with the function itself being templated and duplicated for each
direction.
``` C
static void fft4(FFTComplex *z)
{
FFTSample r1 = z[0].re - z[2].re;
FFTSample r2 = z[0].im - z[2].im;
FFTSample r3 = z[1].re - z[3].re;
FFTSample r4 = z[1].im - z[3].im;
/* r5-r8 second transform */
FFTSample t1 = z[0].re + z[2].re;
FFTSample t2 = z[0].im + z[2].im;
FFTSample t3 = z[1].re + z[3].re;
FFTSample t4 = z[1].im + z[3].im;
/* t5-t8 second transform */
/* 1sub + 1add = 2 instructions */
/* 2 shufs */
FFTSample a3 = t1 - t3;
FFTSample a4 = t2 - t4;
FFTSample b3 = r1 - r4;
FFTSample b2 = r2 - r3;
FFTSample a1 = t1 + t3;
FFTSample a2 = t2 + t4;
FFTSample b1 = r1 + r4;
FFTSample b4 = r2 + r3;
/* 1 add 1 sub 3 shufs */
z[0].re = a1;
z[0].im = a2;
z[2].re = a3;
z[2].im = a4;
z[1].re = b1;
z[1].im = b2;
z[3].re = b3;
z[3].im = b4;
}
```
# 8-point AVX FFT transform
Input must be pre-permuted using the parity lookup table, generated via
`ff_tx_gen_split_radix_parity_revtab`.
``` C
static void fft8(FFTComplex *z)
{
FFTSample r1 = z[0].re - z[4].re;
FFTSample r2 = z[0].im - z[4].im;
FFTSample r3 = z[1].re - z[5].re;
FFTSample r4 = z[1].im - z[5].im;
FFTSample r5 = z[2].re - z[6].re;
FFTSample r6 = z[2].im - z[6].im;
FFTSample r7 = z[3].re - z[7].re;
FFTSample r8 = z[3].im - z[7].im;
FFTSample q1 = z[0].re + z[4].re;
FFTSample q2 = z[0].im + z[4].im;
FFTSample q3 = z[1].re + z[5].re;
FFTSample q4 = z[1].im + z[5].im;
FFTSample q5 = z[2].re + z[6].re;
FFTSample q6 = z[2].im + z[6].im;
FFTSample q7 = z[3].re + z[7].re;
FFTSample q8 = z[3].im + z[7].im;
FFTSample s3 = q1 - q3;
FFTSample s1 = q1 + q3;
FFTSample s4 = q2 - q4;
FFTSample s2 = q2 + q4;
FFTSample s7 = q5 - q7;
FFTSample s5 = q5 + q7;
FFTSample s8 = q6 - q8;
FFTSample s6 = q6 + q8;
FFTSample e1 = s1 * -1;
FFTSample e2 = s2 * -1;
FFTSample e3 = s3 * -1;
FFTSample e4 = s4 * -1;
FFTSample e5 = s5 * 1;
FFTSample e6 = s6 * 1;
FFTSample e7 = s7 * -1;
FFTSample e8 = s8 * 1;
FFTSample w1 = e5 - e1;
FFTSample w2 = e6 - e2;
FFTSample w3 = e8 - e3;
FFTSample w4 = e7 - e4;
FFTSample w5 = s1 - e5;
FFTSample w6 = s2 - e6;
FFTSample w7 = s3 - e8;
FFTSample w8 = s4 - e7;
z[0].re = w1;
z[0].im = w2;
z[2].re = w3;
z[2].im = w4;
z[4].re = w5;
z[4].im = w6;
z[6].re = w7;
z[6].im = w8;
FFTSample z1 = r1 - r4;
FFTSample z2 = r1 + r4;
FFTSample z3 = r3 - r2;
FFTSample z4 = r3 + r2;
FFTSample z5 = r5 - r6;
FFTSample z6 = r5 + r6;
FFTSample z7 = r7 - r8;
FFTSample z8 = r7 + r8;
z3 *= -1;
z5 *= -M_SQRT1_2;
z6 *= -M_SQRT1_2;
z7 *= M_SQRT1_2;
z8 *= M_SQRT1_2;
FFTSample t5 = z7 - z6;
FFTSample t6 = z8 + z5;
FFTSample t7 = z8 - z5;
FFTSample t8 = z7 + z6;
FFTSample u1 = z2 + t5;
FFTSample u2 = z3 + t6;
FFTSample u3 = z1 - t7;
FFTSample u4 = z4 + t8;
FFTSample u5 = z2 - t5;
FFTSample u6 = z3 - t6;
FFTSample u7 = z1 + t7;
FFTSample u8 = z4 - t8;
z[1].re = u1;
z[1].im = u2;
z[3].re = u3;
z[3].im = u4;
z[5].re = u5;
z[5].im = u6;
z[7].re = u7;
z[7].im = u8;
}
```
As you can see, there are 2 independent paths, one for even and one for odd coefficients.
This theme continues throughout the document. Note that in the actual assembly code,
the paths are interleaved to improve unit saturation and CPU dependency tracking, so
to more clearly see them, you'll need to deinterleave the instructions.
# 8-point SSE/ARM64 FFT transform
Input must be pre-permuted using the parity lookup table, generated via
`ff_tx_gen_split_radix_parity_revtab`.
``` C
static void fft8(FFTComplex *z)
{
FFTSample r1 = z[0].re - z[4].re;
FFTSample r2 = z[0].im - z[4].im;
FFTSample r3 = z[1].re - z[5].re;
FFTSample r4 = z[1].im - z[5].im;
FFTSample j1 = z[2].re - z[6].re;
FFTSample j2 = z[2].im - z[6].im;
FFTSample j3 = z[3].re - z[7].re;
FFTSample j4 = z[3].im - z[7].im;
FFTSample q1 = z[0].re + z[4].re;
FFTSample q2 = z[0].im + z[4].im;
FFTSample q3 = z[1].re + z[5].re;
FFTSample q4 = z[1].im + z[5].im;
FFTSample k1 = z[2].re + z[6].re;
FFTSample k2 = z[2].im + z[6].im;
FFTSample k3 = z[3].re + z[7].re;
FFTSample k4 = z[3].im + z[7].im;
/* 2 add 2 sub = 4 */
/* 2 shufs, 1 add 1 sub = 4 */
FFTSample s1 = q1 + q3;
FFTSample s2 = q2 + q4;
FFTSample g1 = k3 + k1;
FFTSample g2 = k2 + k4;
FFTSample s3 = q1 - q3;
FFTSample s4 = q2 - q4;
FFTSample g4 = k3 - k1;
FFTSample g3 = k2 - k4;
/* 1 unpack + 1 shuffle = 2 */
/* 1 add */
FFTSample w1 = s1 + g1;
FFTSample w2 = s2 + g2;
FFTSample w3 = s3 + g3;
FFTSample w4 = s4 + g4;
/* 1 sub */
FFTSample h1 = s1 - g1;
FFTSample h2 = s2 - g2;
FFTSample h3 = s3 - g3;
FFTSample h4 = s4 - g4;
z[0].re = w1;
z[0].im = w2;
z[2].re = w3;
z[2].im = w4;
z[4].re = h1;
z[4].im = h2;
z[6].re = h3;
z[6].im = h4;
/* 1 shuf + 1 shuf + 1 xor + 1 addsub */
FFTSample z1 = r1 + r4;
FFTSample z2 = r2 - r3;
FFTSample z3 = r1 - r4;
FFTSample z4 = r2 + r3;
/* 1 mult */
j1 *= M_SQRT1_2;
j2 *= -M_SQRT1_2;
j3 *= -M_SQRT1_2;
j4 *= M_SQRT1_2;
/* 1 shuf + 1 addsub */
FFTSample l2 = j1 - j2;
FFTSample l1 = j2 + j1;
FFTSample l4 = j3 - j4;
FFTSample l3 = j4 + j3;
/* 1 shuf + 1 addsub */
FFTSample t1 = l3 - l2;
FFTSample t2 = l4 + l1;
FFTSample t3 = l1 - l4;
FFTSample t4 = l2 + l3;
/* 1 add */
FFTSample u1 = z1 - t1;
FFTSample u2 = z2 - t2;
FFTSample u3 = z3 - t3;
FFTSample u4 = z4 - t4;
/* 1 sub */
FFTSample o1 = z1 + t1;
FFTSample o2 = z2 + t2;
FFTSample o3 = z3 + t3;
FFTSample o4 = z4 + t4;
z[1].re = u1;
z[1].im = u2;
z[3].re = u3;
z[3].im = u4;
z[5].re = o1;
z[5].im = o2;
z[7].re = o3;
z[7].im = o4;
}
```
Most functions here are highly tuned to use x86's addsub instruction to save on
external sign mask loading.
# 16-point AVX FFT transform
This version expects the output of the 8 and 4-point transforms to follow the
even/odd convention established above.
``` C
static void fft16(FFTComplex *z)
{
FFTSample cos_16_1 = 0.92387950420379638671875f;
FFTSample cos_16_3 = 0.3826834261417388916015625f;
fft8(z);
fft4(z+8);
fft4(z+10);
FFTSample s[32];
/*
xorps m1, m1 - free
mulps m0
shufps m1, m1, m0
xorps
addsub
shufps
mulps
mulps
addps
or (fma3)
shufps
shufps
mulps
mulps
fma
fma
*/
s[0] = z[8].re*( 1) - z[8].im*( 0);
s[1] = z[8].im*( 1) + z[8].re*( 0);
s[2] = z[9].re*( 1) - z[9].im*(-1);
s[3] = z[9].im*( 1) + z[9].re*(-1);
s[4] = z[10].re*( 1) - z[10].im*( 0);
s[5] = z[10].im*( 1) + z[10].re*( 0);
s[6] = z[11].re*( 1) - z[11].im*( 1);
s[7] = z[11].im*( 1) + z[11].re*( 1);
s[8] = z[12].re*( cos_16_1) - z[12].im*( -cos_16_3);
s[9] = z[12].im*( cos_16_1) + z[12].re*( -cos_16_3);
s[10] = z[13].re*( cos_16_3) - z[13].im*( -cos_16_1);
s[11] = z[13].im*( cos_16_3) + z[13].re*( -cos_16_1);
s[12] = z[14].re*( cos_16_1) - z[14].im*( cos_16_3);
s[13] = z[14].im*( -cos_16_1) + z[14].re*( -cos_16_3);
s[14] = z[15].re*( cos_16_3) - z[15].im*( cos_16_1);
s[15] = z[15].im*( -cos_16_3) + z[15].re*( -cos_16_1);
s[2] *= M_SQRT1_2;
s[3] *= M_SQRT1_2;
s[5] *= -1;
s[6] *= M_SQRT1_2;
s[7] *= -M_SQRT1_2;
FFTSample w5 = s[0] + s[4];
FFTSample w6 = s[1] - s[5];
FFTSample x5 = s[2] + s[6];
FFTSample x6 = s[3] - s[7];
FFTSample w3 = s[4] - s[0];
FFTSample w4 = s[5] + s[1];
FFTSample x3 = s[6] - s[2];
FFTSample x4 = s[7] + s[3];
FFTSample y5 = s[8] + s[12];
FFTSample y6 = s[9] - s[13];
FFTSample u5 = s[10] + s[14];
FFTSample u6 = s[11] - s[15];
FFTSample y3 = s[12] - s[8];
FFTSample y4 = s[13] + s[9];
FFTSample u3 = s[14] - s[10];
FFTSample u4 = s[15] + s[11];
/* 2xorps, 2vperm2fs, 2 adds, 2 vpermilps = 8 */
FFTSample o1 = z[0].re + w5;
FFTSample o2 = z[0].im + w6;
FFTSample o5 = z[1].re + x5;
FFTSample o6 = z[1].im + x6;
FFTSample o9 = z[2].re + w4; //h
FFTSample o10 = z[2].im + w3;
FFTSample o13 = z[3].re + x4;
FFTSample o14 = z[3].im + x3;
FFTSample o17 = z[0].re - w5;
FFTSample o18 = z[0].im - w6;
FFTSample o21 = z[1].re - x5;
FFTSample o22 = z[1].im - x6;
FFTSample o25 = z[2].re - w4; //h
FFTSample o26 = z[2].im - w3;
FFTSample o29 = z[3].re - x4;
FFTSample o30 = z[3].im - x3;
FFTSample o3 = z[4].re + y5;
FFTSample o4 = z[4].im + y6;
FFTSample o7 = z[5].re + u5;
FFTSample o8 = z[5].im + u6;
FFTSample o11 = z[6].re + y4; //h
FFTSample o12 = z[6].im + y3;
FFTSample o15 = z[7].re + u4;
FFTSample o16 = z[7].im + u3;
FFTSample o19 = z[4].re - y5;
FFTSample o20 = z[4].im - y6;
FFTSample o23 = z[5].re - u5;
FFTSample o24 = z[5].im - u6;
FFTSample o27 = z[6].re - y4; //h
FFTSample o28 = z[6].im - y3;
FFTSample o31 = z[7].re - u4;
FFTSample o32 = z[7].im - u3;
/* This is just deinterleaving, happens separately */
z[0] = (FFTComplex){ o1, o2 };
z[1] = (FFTComplex){ o3, o4 };
z[2] = (FFTComplex){ o5, o6 };
z[3] = (FFTComplex){ o7, o8 };
z[4] = (FFTComplex){ o9, o10 };
z[5] = (FFTComplex){ o11, o12 };
z[6] = (FFTComplex){ o13, o14 };
z[7] = (FFTComplex){ o15, o16 };
z[8] = (FFTComplex){ o17, o18 };
z[9] = (FFTComplex){ o19, o20 };
z[10] = (FFTComplex){ o21, o22 };
z[11] = (FFTComplex){ o23, o24 };
z[12] = (FFTComplex){ o25, o26 };
z[13] = (FFTComplex){ o27, o28 };
z[14] = (FFTComplex){ o29, o30 };
z[15] = (FFTComplex){ o31, o32 };
}
```
# AVX split-radix synthesis
To create larger transforms, the following unrolling of the C split-radix
function is used.
``` C
#define BF(x, y, a, b) \
do { \
x = (a) - (b); \
y = (a) + (b); \
} while (0)
#define BUTTERFLIES(a0,a1,a2,a3) \
do { \
r0=a0.re; \
i0=a0.im; \
r1=a1.re; \
i1=a1.im; \
BF(q3, q5, q5, q1); \
BF(a2.re, a0.re, r0, q5); \
BF(a3.im, a1.im, i1, q3); \
BF(q4, q6, q2, q6); \
BF(a3.re, a1.re, r1, q4); \
BF(a2.im, a0.im, i0, q6); \
} while (0)
#undef TRANSFORM
#define TRANSFORM(a0,a1,a2,a3,wre,wim) \
do { \
CMUL(q1, q2, a2.re, a2.im, wre, -wim); \
CMUL(q5, q6, a3.re, a3.im, wre, wim); \
BUTTERFLIES(a0, a1, a2, a3); \
} while (0)
#define CMUL(dre, dim, are, aim, bre, bim) \
do { \
(dre) = (are) * (bre) - (aim) * (bim); \
(dim) = (are) * (bim) + (aim) * (bre); \
} while (0)
static void recombine(FFTComplex *z, const FFTSample *cos,
unsigned int n)
{
const int o1 = 2*n;
const int o2 = 4*n;
const int o3 = 6*n;
const FFTSample *wim = cos + o1 - 7;
FFTSample q1, q2, q3, q4, q5, q6, r0, i0, r1, i1;
#if 0
for (int i = 0; i < n; i += 4) {
#endif
#if 0
TRANSFORM(z[ 0 + 0], z[ 0 + 4], z[o2 + 0], z[o2 + 2], cos[0], wim[7]);
TRANSFORM(z[ 0 + 1], z[ 0 + 5], z[o2 + 1], z[o2 + 3], cos[2], wim[5]);
TRANSFORM(z[ 0 + 2], z[ 0 + 6], z[o2 + 4], z[o2 + 6], cos[4], wim[3]);
TRANSFORM(z[ 0 + 3], z[ 0 + 7], z[o2 + 5], z[o2 + 7], cos[6], wim[1]);
TRANSFORM(z[o1 + 0], z[o1 + 4], z[o3 + 0], z[o3 + 2], cos[1], wim[6]);
TRANSFORM(z[o1 + 1], z[o1 + 5], z[o3 + 1], z[o3 + 3], cos[3], wim[4]);
TRANSFORM(z[o1 + 2], z[o1 + 6], z[o3 + 4], z[o3 + 6], cos[5], wim[2]);
TRANSFORM(z[o1 + 3], z[o1 + 7], z[o3 + 5], z[o3 + 7], cos[7], wim[0]);
#else
FFTSample h[8], j[8], r[8], w[8];
FFTSample t[8];
FFTComplex *m0 = &z[0];
FFTComplex *m1 = &z[4];
FFTComplex *m2 = &z[o2 + 0];
FFTComplex *m3 = &z[o2 + 4];
const FFTSample *t1 = &cos[0];
const FFTSample *t2 = &wim[0];
/* 2 loads (tabs) */
/* 2 vperm2fs, 2 shufs (im), 2 shufs (tabs) */
/* 1 xor, 1 add, 1 sub, 4 mults OR 2 mults, 2 fmas */
/* 13 OR 10ish (-2 each for second passovers!) */
w[0] = m2[0].im*t1[0] - m2[0].re*t2[7];
w[1] = m2[0].re*t1[0] + m2[0].im*t2[7];
w[2] = m2[1].im*t1[2] - m2[1].re*t2[5];
w[3] = m2[1].re*t1[2] + m2[1].im*t2[5];
w[4] = m3[0].im*t1[4] - m3[0].re*t2[3];
w[5] = m3[0].re*t1[4] + m3[0].im*t2[3];
w[6] = m3[1].im*t1[6] - m3[1].re*t2[1];
w[7] = m3[1].re*t1[6] + m3[1].im*t2[1];
j[0] = m2[2].im*t1[0] + m2[2].re*t2[7];
j[1] = m2[2].re*t1[0] - m2[2].im*t2[7];
j[2] = m2[3].im*t1[2] + m2[3].re*t2[5];
j[3] = m2[3].re*t1[2] - m2[3].im*t2[5];
j[4] = m3[2].im*t1[4] + m3[2].re*t2[3];
j[5] = m3[2].re*t1[4] - m3[2].im*t2[3];
j[6] = m3[3].im*t1[6] + m3[3].re*t2[1];
j[7] = m3[3].re*t1[6] - m3[3].im*t2[1];
/* 1 add + 1 shuf */
t[1] = j[0] + w[0];
t[0] = j[1] + w[1];
t[3] = j[2] + w[2];
t[2] = j[3] + w[3];
t[5] = j[4] + w[4];
t[4] = j[5] + w[5];
t[7] = j[6] + w[6];
t[6] = j[7] + w[7];
/* 1 sub + 1 xor */
r[0] = (w[0] - j[0]);
r[1] = -(w[1] - j[1]);
r[2] = (w[2] - j[2]);
r[3] = -(w[3] - j[3]);
r[4] = (w[4] - j[4]);
r[5] = -(w[5] - j[5]);
r[6] = (w[6] - j[6]);
r[7] = -(w[7] - j[7]);
/* Min: 2 subs, 2 adds, 2 vperm2fs (OPTIONAL) */
m2[0].re = m0[0].re - t[0];
m2[0].im = m0[0].im - t[1];
m2[1].re = m0[1].re - t[2];
m2[1].im = m0[1].im - t[3];
m3[0].re = m0[2].re - t[4];
m3[0].im = m0[2].im - t[5];
m3[1].re = m0[3].re - t[6];
m3[1].im = m0[3].im - t[7];
m2[2].re = m1[0].re - r[0];
m2[2].im = m1[0].im - r[1];
m2[3].re = m1[1].re - r[2];
m2[3].im = m1[1].im - r[3];
m3[2].re = m1[2].re - r[4];
m3[2].im = m1[2].im - r[5];
m3[3].re = m1[3].re - r[6];
m3[3].im = m1[3].im - r[7];
m0[0].re = m0[0].re + t[0];
m0[0].im = m0[0].im + t[1];
m0[1].re = m0[1].re + t[2];
m0[1].im = m0[1].im + t[3];
m0[2].re = m0[2].re + t[4];
m0[2].im = m0[2].im + t[5];
m0[3].re = m0[3].re + t[6];
m0[3].im = m0[3].im + t[7];
m1[0].re = m1[0].re + r[0];
m1[0].im = m1[0].im + r[1];
m1[1].re = m1[1].re + r[2];
m1[1].im = m1[1].im + r[3];
m1[2].re = m1[2].re + r[4];
m1[2].im = m1[2].im + r[5];
m1[3].re = m1[3].re + r[6];
m1[3].im = m1[3].im + r[7];
/* Identical for below, but with the following parameters */
m0 = &z[o1];
m1 = &z[o1 + 4];
m2 = &z[o3 + 0];
m3 = &z[o3 + 4];
t1 = &cos[1];
t2 = &wim[-1];
w[0] = m2[0].im*t1[0] - m2[0].re*t2[7];
w[1] = m2[0].re*t1[0] + m2[0].im*t2[7];
w[2] = m2[1].im*t1[2] - m2[1].re*t2[5];
w[3] = m2[1].re*t1[2] + m2[1].im*t2[5];
w[4] = m3[0].im*t1[4] - m3[0].re*t2[3];
w[5] = m3[0].re*t1[4] + m3[0].im*t2[3];
w[6] = m3[1].im*t1[6] - m3[1].re*t2[1];
w[7] = m3[1].re*t1[6] + m3[1].im*t2[1];
j[0] = m2[2].im*t1[0] + m2[2].re*t2[7];
j[1] = m2[2].re*t1[0] - m2[2].im*t2[7];
j[2] = m2[3].im*t1[2] + m2[3].re*t2[5];
j[3] = m2[3].re*t1[2] - m2[3].im*t2[5];
j[4] = m3[2].im*t1[4] + m3[2].re*t2[3];
j[5] = m3[2].re*t1[4] - m3[2].im*t2[3];
j[6] = m3[3].im*t1[6] + m3[3].re*t2[1];
j[7] = m3[3].re*t1[6] - m3[3].im*t2[1];
/* 1 add + 1 shuf */
t[1] = j[0] + w[0];
t[0] = j[1] + w[1];
t[3] = j[2] + w[2];
t[2] = j[3] + w[3];
t[5] = j[4] + w[4];
t[4] = j[5] + w[5];
t[7] = j[6] + w[6];
t[6] = j[7] + w[7];
/* 1 sub + 1 xor */
r[0] = (w[0] - j[0]);
r[1] = -(w[1] - j[1]);
r[2] = (w[2] - j[2]);
r[3] = -(w[3] - j[3]);
r[4] = (w[4] - j[4]);
r[5] = -(w[5] - j[5]);
r[6] = (w[6] - j[6]);
r[7] = -(w[7] - j[7]);
/* Min: 2 subs, 2 adds, 2 vperm2fs (OPTIONAL) */
m2[0].re = m0[0].re - t[0];
m2[0].im = m0[0].im - t[1];
m2[1].re = m0[1].re - t[2];
m2[1].im = m0[1].im - t[3];
m3[0].re = m0[2].re - t[4];
m3[0].im = m0[2].im - t[5];
m3[1].re = m0[3].re - t[6];
m3[1].im = m0[3].im - t[7];
m2[2].re = m1[0].re - r[0];
m2[2].im = m1[0].im - r[1];
m2[3].re = m1[1].re - r[2];
m2[3].im = m1[1].im - r[3];
m3[2].re = m1[2].re - r[4];
m3[2].im = m1[2].im - r[5];
m3[3].re = m1[3].re - r[6];
m3[3].im = m1[3].im - r[7];
m0[0].re = m0[0].re + t[0];
m0[0].im = m0[0].im + t[1];
m0[1].re = m0[1].re + t[2];
m0[1].im = m0[1].im + t[3];
m0[2].re = m0[2].re + t[4];
m0[2].im = m0[2].im + t[5];
m0[3].re = m0[3].re + t[6];
m0[3].im = m0[3].im + t[7];
m1[0].re = m1[0].re + r[0];
m1[0].im = m1[0].im + r[1];
m1[1].re = m1[1].re + r[2];
m1[1].im = m1[1].im + r[3];
m1[2].re = m1[2].re + r[4];
m1[2].im = m1[2].im + r[5];
m1[3].re = m1[3].re + r[6];
m1[3].im = m1[3].im + r[7];
#endif
#if 0
z += 4; // !!!
cos += 2*4;
wim -= 2*4;
}
#endif
}
```
The macros used are identical to those in the generic C version, only with all
variable declarations exported to the function body.
An important point here is that the high frequency registers (m2 and m3) have
their high and low halves swapped in the output. This is intentional, as the
inputs must also have the same layout, and therefore, the input swapping is only
performed once for the bottom-most basis transform, with all subsequent combinations
using the already swapped halves.
Also note that this function requires a special iteration way, due to coefficients
beginning to overlap, particularly `[o1]` with `[0]` after the second iteration.
To iterate further, set `z = &z[16]` via `z += 8` for the second iteration. After
the 4th iteration, the layout resets, so repeat the same.

View File

@ -719,22 +719,32 @@ FL+FR+FC+BL+BR+BC+SL+SR
FL+FR+FC+BL+BR+BC+SL+SR+WL+WR+TBL+TBR+TBC+TFC+TFL+TFR
@item downmix
DL+DR
@item 22.2
FL+FR+FC+LFE+BL+BR+FLC+FRC+BC+SL+SR+TC+TFL+TFC+TFR+TBL+TBC+TBR+LFE2+TSL+TSR+BFC+BFL+BFR
@end table
A custom channel layout can be specified as a sequence of terms, separated by
'+' or '|'. Each term can be:
A custom channel layout can be specified as a sequence of terms, separated by '+'.
Each term can be:
@itemize
@item
the name of a single channel (e.g. @samp{FL}, @samp{FR}, @samp{FC}, @samp{LFE}, etc.),
each optionally containing a custom name after a '@@', (e.g. @samp{FL@@Left},
@samp{FR@@Right}, @samp{FC@@Center}, @samp{LFE@@Low_Frequency}, etc.)
@end itemize
A standard channel layout can be specified by the following:
@itemize
@item
the name of a single channel (e.g. @samp{FL}, @samp{FR}, @samp{FC}, @samp{LFE}, etc.)
@item
the name of a standard channel layout (e.g. @samp{mono},
@samp{stereo}, @samp{4.0}, @samp{quad}, @samp{5.0}, etc.)
@item
the name of a single channel (e.g. @samp{FL}, @samp{FR}, @samp{FC}, @samp{LFE}, etc.)
@item
a number of channels, in decimal, followed by 'c', yielding the default channel
layout for that number of channels (see the function
@code{av_get_default_channel_layout}). Note that not all channel counts have a
@code{av_channel_layout_default}). Note that not all channel counts have a
default layout.
@item
@ -751,7 +761,7 @@ Before libavutil version 53 the trailing character "c" to specify a number of
channels was optional, but now it is required, while a channel layout mask can
also be specified as a decimal number (if and only if not followed by "c" or "C").
See also the function @code{av_get_channel_layout} defined in
See also the function @code{av_channel_layout_from_string} defined in
@file{libavutil/channel_layout.h}.
@c man end SYNTAX

2
ffbuild/.gitignore vendored
View File

@ -1,4 +1,6 @@
/.config
/bin2c
/bin2c.exe
/config.fate
/config.log
/config.mak

View File

@ -8,7 +8,9 @@ OBJS-$(HAVE_MIPSFPU) += $(MIPSFPU-OBJS) $(MIPSFPU-OBJS-yes)
OBJS-$(HAVE_MIPSDSP) += $(MIPSDSP-OBJS) $(MIPSDSP-OBJS-yes)
OBJS-$(HAVE_MIPSDSPR2) += $(MIPSDSPR2-OBJS) $(MIPSDSPR2-OBJS-yes)
OBJS-$(HAVE_MSA) += $(MSA-OBJS) $(MSA-OBJS-yes)
OBJS-$(HAVE_MMI) += $(MMI-OBJS) $(MMI-OBJS-yes)
OBJS-$(HAVE_MMI) += $(MMI-OBJS) $(MMI-OBJS-yes)
OBJS-$(HAVE_LSX) += $(LSX-OBJS) $(LSX-OBJS-yes)
OBJS-$(HAVE_LASX) += $(LASX-OBJS) $(LASX-OBJS-yes)
OBJS-$(HAVE_ALTIVEC) += $(ALTIVEC-OBJS) $(ALTIVEC-OBJS-yes)
OBJS-$(HAVE_VSX) += $(VSX-OBJS) $(VSX-OBJS-yes)

76
ffbuild/bin2c.c Normal file
View File

@ -0,0 +1,76 @@
/*
* This file is part of FFmpeg.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
#include <string.h>
#include <stdio.h>
int main(int argc, char **argv)
{
const char *name;
FILE *input, *output;
unsigned int length = 0;
unsigned char data;
if (argc < 3 || argc > 4)
return 1;
input = fopen(argv[1], "rb");
if (!input)
return -1;
output = fopen(argv[2], "wb");
if (!output)
return -1;
if (argc == 4) {
name = argv[3];
} else {
size_t arglen = strlen(argv[1]);
name = argv[1];
for (int i = 0; i < arglen; i++) {
if (argv[1][i] == '.')
argv[1][i] = '_';
else if (argv[1][i] == '/')
name = &argv[1][i+1];
}
}
fprintf(output, "const unsigned char ff_%s_data[] = { ", name);
while (fread(&data, 1, 1, input) > 0) {
fprintf(output, "0x%02x, ", data);
length++;
}
fprintf(output, "0x00 };\n");
fprintf(output, "const unsigned int ff_%s_len = %u;\n", name, length);
fclose(output);
if (ferror(input) || !feof(input))
return -1;
fclose(input);
return 0;
}

View File

@ -12,10 +12,13 @@ endif
ifndef SUBDIR
BIN2CEXE = ffbuild/bin2c$(HOSTEXESUF)
BIN2C = $(BIN2CEXE)
ifndef V
Q = @
ECHO = printf "$(1)\t%s\n" $(2)
BRIEF = CC CXX OBJCC HOSTCC HOSTLD AS X86ASM AR LD STRIP CP WINDRES NVCC
BRIEF = CC CXX OBJCC HOSTCC HOSTLD AS X86ASM AR LD STRIP CP WINDRES NVCC BIN2C
SILENT = DEPCC DEPHOSTCC DEPAS DEPX86ASM RANLIB RM
MSG = $@
@ -26,7 +29,8 @@ $(foreach VAR,$(SILENT),$(eval override $(VAR) = @$($(VAR))))
$(eval INSTALL = @$(call ECHO,INSTALL,$$(^:$(SRC_DIR)/%=%)); $(INSTALL))
endif
ALLFFLIBS = avcodec avdevice avfilter avformat avresample avutil postproc swscale swresample
# Prepend to a recursively expanded variable without making it simply expanded.
PREPEND = $(eval $(1) = $(patsubst %,$$(%), $(2)) $(value $(1)))
# NASM requires -I path terminated with /
IFLAGS := -I. -I$(SRC_LINK)/
@ -36,7 +40,9 @@ CCFLAGS = $(CPPFLAGS) $(CFLAGS)
OBJCFLAGS += $(EOBJCFLAGS)
OBJCCFLAGS = $(CPPFLAGS) $(CFLAGS) $(OBJCFLAGS)
ASFLAGS := $(CPPFLAGS) $(ASFLAGS)
CXXFLAGS := $(CPPFLAGS) $(CFLAGS) $(CXXFLAGS)
# Use PREPEND here so that later (target-dependent) additions to CPPFLAGS
# end up in CXXFLAGS.
$(call PREPEND,CXXFLAGS, CPPFLAGS CFLAGS)
X86ASMFLAGS += $(IFLAGS:%=%/) -I$(<D)/ -Pconfig.asm
HOSTCCFLAGS = $(IFLAGS) $(HOSTCPPFLAGS) $(HOSTCFLAGS)
@ -56,6 +62,8 @@ COMPILE_HOSTC = $(call COMPILE,HOSTCC)
COMPILE_NVCC = $(call COMPILE,NVCC)
COMPILE_MMI = $(call COMPILE,CC,MMIFLAGS)
COMPILE_MSA = $(call COMPILE,CC,MSAFLAGS)
COMPILE_LSX = $(call COMPILE,CC,LSXFLAGS)
COMPILE_LASX = $(call COMPILE,CC,LASXFLAGS)
%_mmi.o: %_mmi.c
$(COMPILE_MMI)
@ -63,6 +71,12 @@ COMPILE_MSA = $(call COMPILE,CC,MSAFLAGS)
%_msa.o: %_msa.c
$(COMPILE_MSA)
%_lsx.o: %_lsx.c
$(COMPILE_LSX)
%_lasx.o: %_lasx.c
$(COMPILE_LASX)
%.o: %.c
$(COMPILE_C)
@ -98,11 +112,35 @@ COMPILE_MSA = $(call COMPILE,CC,MSAFLAGS)
%.h.c:
$(Q)echo '#include "$*.h"' >$@
$(BIN2CEXE): ffbuild/bin2c_host.o
$(HOSTLD) $(HOSTLDFLAGS) $(HOSTLD_O) $^ $(HOSTEXTRALIBS)
%.metal.air: %.metal
$(METALCC) $< -o $@
%.metallib: %.metal.air
$(METALLIB) --split-module-without-linking $< -o $@
%.metallib.c: %.metallib $(BIN2CEXE)
$(BIN2C) $< $@ $(subst .,_,$(basename $(notdir $@)))
%.ptx: %.cu $(SRC_PATH)/compat/cuda/cuda_runtime.h
$(COMPILE_NVCC)
%.ptx.c: %.ptx
$(Q)sh $(SRC_PATH)/compat/cuda/ptx2c.sh $@ $(patsubst $(SRC_PATH)/%,$(SRC_LINK)/%,$<)
ifdef CONFIG_PTX_COMPRESSION
%.ptx.gz: TAG = GZIP
%.ptx.gz: %.ptx
$(M)gzip -c9 $(patsubst $(SRC_PATH)/%,$(SRC_LINK)/%,$<) >$@
%.ptx.c: %.ptx.gz $(BIN2CEXE)
$(BIN2C) $(patsubst $(SRC_PATH)/%,$(SRC_LINK)/%,$<) $@ $(subst .,_,$(basename $(notdir $@)))
else
%.ptx.c: %.ptx $(BIN2CEXE)
$(BIN2C) $(patsubst $(SRC_PATH)/%,$(SRC_LINK)/%,$<) $@ $(subst .,_,$(basename $(notdir $@)))
endif
clean::
$(RM) $(BIN2CEXE)
%.c %.h %.pc %.ver %.version: TAG = GEN
@ -122,6 +160,8 @@ include $(SRC_PATH)/ffbuild/arch.mak
OBJS += $(OBJS-yes)
SLIBOBJS += $(SLIBOBJS-yes)
SHLIBOBJS += $(SHLIBOBJS-yes)
STLIBOBJS += $(STLIBOBJS-yes)
FFLIBS := $($(NAME)_FFLIBS) $(FFLIBS-yes) $(FFLIBS)
TESTPROGS += $(TESTPROGS-yes)
@ -130,6 +170,8 @@ FFEXTRALIBS := $(LDLIBS:%=$(LD_LIB)) $(foreach lib,EXTRALIBS-$(NAME) $(FFLIBS:%=
OBJS := $(sort $(OBJS:%=$(SUBDIR)%))
SLIBOBJS := $(sort $(SLIBOBJS:%=$(SUBDIR)%))
SHLIBOBJS := $(sort $(SHLIBOBJS:%=$(SUBDIR)%))
STLIBOBJS := $(sort $(STLIBOBJS:%=$(SUBDIR)%))
TESTOBJS := $(TESTOBJS:%=$(SUBDIR)tests/%) $(TESTPROGS:%=$(SUBDIR)tests/%.o)
TESTPROGS := $(TESTPROGS:%=$(SUBDIR)tests/%$(EXESUF))
HOSTOBJS := $(HOSTPROGS:%=$(SUBDIR)%.o)
@ -151,7 +193,7 @@ HOBJS = $(filter-out $(SKIPHEADERS:.h=.h.o),$(ALLHEADERS:.h=.h.o))
PTXOBJS = $(filter %.ptx.o,$(OBJS))
$(HOBJS): CCFLAGS += $(CFLAGS_HEADERS)
checkheaders: $(HOBJS)
.SECONDARY: $(HOBJS:.o=.c) $(PTXOBJS:.o=.c) $(PTXOBJS:.o=)
.SECONDARY: $(HOBJS:.o=.c) $(PTXOBJS:.o=.c) $(PTXOBJS:.o=.gz) $(PTXOBJS:.o=)
alltools: $(TOOLS)
@ -165,12 +207,14 @@ $(OBJS): | $(sort $(dir $(OBJS)))
$(HOBJS): | $(sort $(dir $(HOBJS)))
$(HOSTOBJS): | $(sort $(dir $(HOSTOBJS)))
$(SLIBOBJS): | $(sort $(dir $(SLIBOBJS)))
$(SHLIBOBJS): | $(sort $(dir $(SHLIBOBJS)))
$(STLIBOBJS): | $(sort $(dir $(STLIBOBJS)))
$(TESTOBJS): | $(sort $(dir $(TESTOBJS)))
$(TOOLOBJS): | tools
OUTDIRS := $(OUTDIRS) $(dir $(OBJS) $(HOBJS) $(HOSTOBJS) $(SLIBOBJS) $(TESTOBJS))
OUTDIRS := $(OUTDIRS) $(dir $(OBJS) $(HOBJS) $(HOSTOBJS) $(SLIBOBJS) $(SHLIBOBJS) $(STLIBOBJS) $(TESTOBJS))
CLEANSUFFIXES = *.d *.gcda *.gcno *.h.c *.ho *.map *.o *.pc *.ptx *.ptx.c *.ver *.version *$(DEFAULT_X86ASMD).asm *~ *.ilk *.pdb
CLEANSUFFIXES = *.d *.gcda *.gcno *.h.c *.ho *.map *.o *.pc *.ptx *.ptx.gz *.ptx.c *.ver *.version *$(DEFAULT_X86ASMD).asm *~ *.ilk *.pdb
LIBSUFFIXES = *.a *.lib *.so *.so.* *.dylib *.dll *.def *.dll.a
define RULES
@ -180,4 +224,4 @@ endef
$(eval $(RULES))
-include $(wildcard $(OBJS:.o=.d) $(HOSTOBJS:.o=.d) $(TESTOBJS:.o=.d) $(HOBJS:.o=.d) $(SLIBOBJS:.o=.d)) $(OBJS:.o=$(DEFAULT_X86ASMD).d)
-include $(wildcard $(OBJS:.o=.d) $(HOSTOBJS:.o=.d) $(TESTOBJS:.o=.d) $(HOBJS:.o=.d) $(SHLIBOBJS:.o=.d) $(STLIBOBJS:.o=.d) $(SLIBOBJS:.o=.d)) $(OBJS:.o=$(DEFAULT_X86ASMD).d)

View File

@ -14,10 +14,26 @@ INSTHEADERS := $(INSTHEADERS) $(HEADERS:%=$(SUBDIR)%)
all-$(CONFIG_STATIC): $(SUBDIR)$(LIBNAME) $(SUBDIR)lib$(FULLNAME).pc
all-$(CONFIG_SHARED): $(SUBDIR)$(SLIBNAME) $(SUBDIR)lib$(FULLNAME).pc
LIBOBJS := $(OBJS) $(SUBDIR)%.h.o $(TESTOBJS)
LIBOBJS := $(OBJS) $(SHLIBOBJS) $(STLIBOBJS) $(SUBDIR)%.h.o $(TESTOBJS)
$(LIBOBJS) $(LIBOBJS:.o=.s) $(LIBOBJS:.o=.i): CPPFLAGS += -DHAVE_AV_CONFIG_H
$(SUBDIR)$(LIBNAME): $(OBJS)
ifdef CONFIG_SHARED
# In case both shared libs and static libs are enabled, it can happen
# that a user might want to link e.g. libavformat statically, but
# libavcodec and the other libs dynamically. In this case
# libavformat won't be able to access libavcodec's internal symbols,
# so that they have to be duplicated into the archive just like
# for purely shared builds.
# Test programs are always statically linked against their library
# to be able to access their library's internals, even with shared builds.
# Yet linking against dependend libraries still uses dynamic linking.
# This means that we are in the scenario described above.
# In case only static libs are used, the linker will only use
# one of these copies; this depends on the duplicated object files
# containing exactly the same symbols.
OBJS += $(SHLIBOBJS)
endif
$(SUBDIR)$(LIBNAME): $(OBJS) $(STLIBOBJS)
$(RM) $@
$(AR) $(ARFLAGS) $(AR_O) $^
$(RANLIB) $@
@ -36,8 +52,8 @@ $(LIBOBJS): CPPFLAGS += -DBUILDING_$(NAME)
$(TESTPROGS) $(TOOLS): %$(EXESUF): %.o
$$(LD) $(LDFLAGS) $(LDEXEFLAGS) $$(LD_O) $$(filter %.o,$$^) $$(THISLIB) $(FFEXTRALIBS) $$(EXTRALIBS-$$(*F)) $$(ELIBS)
$(SUBDIR)lib$(NAME).version: $(SUBDIR)version.h | $(SUBDIR)
$$(M) $$(SRC_PATH)/ffbuild/libversion.sh $(NAME) $$< > $$@
$(SUBDIR)lib$(NAME).version: $(SUBDIR)version.h $(SUBDIR)version_major.h | $(SUBDIR)
$$(M) $$(SRC_PATH)/ffbuild/libversion.sh $(NAME) $$^ > $$@
$(SUBDIR)lib$(FULLNAME).pc: $(SUBDIR)version.h ffbuild/config.sh | $(SUBDIR)
$$(M) $$(SRC_PATH)/ffbuild/pkgconfig_generate.sh $(NAME) "$(DESC)"
@ -48,7 +64,7 @@ $(SUBDIR)lib$(NAME).ver: $(SUBDIR)lib$(NAME).v $(OBJS)
$(SUBDIR)$(SLIBNAME): $(SUBDIR)$(SLIBNAME_WITH_MAJOR)
$(Q)cd ./$(SUBDIR) && $(LN_S) $(SLIBNAME_WITH_MAJOR) $(SLIBNAME)
$(SUBDIR)$(SLIBNAME_WITH_MAJOR): $(OBJS) $(SLIBOBJS) $(SUBDIR)lib$(NAME).ver
$(SUBDIR)$(SLIBNAME_WITH_MAJOR): $(OBJS) $(SHLIBOBJS) $(SLIBOBJS) $(SUBDIR)lib$(NAME).ver
$(SLIB_CREATE_DEF_CMD)
$$(LD) $(SHFLAGS) $(LDFLAGS) $(LDSOFLAGS) $$(LD_O) $$(filter %.o,$$^) $(FFEXTRALIBS)
$(SLIB_EXTRA_CMD)

View File

@ -5,8 +5,12 @@ toupper(){
name=lib$1
ucname=$(toupper ${name})
file=$2
file2=$3
eval $(awk "/#define ${ucname}_VERSION_M/ { print \$2 \"=\" \$3 }" "$file")
if [ -f "$file2" ]; then
eval $(awk "/#define ${ucname}_VERSION_M/ { print \$2 \"=\" \$3 }" "$file2")
fi
eval ${ucname}_VERSION=\$${ucname}_VERSION_MAJOR.\$${ucname}_VERSION_MINOR.\$${ucname}_VERSION_MICRO
eval echo "${name}_VERSION=\$${ucname}_VERSION"
eval echo "${name}_VERSION_MAJOR=\$${ucname}_VERSION_MAJOR"

View File

@ -9,15 +9,14 @@ AVBASENAMES = ffmpeg ffplay ffprobe
ALLAVPROGS = $(AVBASENAMES:%=%$(PROGSSUF)$(EXESUF))
ALLAVPROGS_G = $(AVBASENAMES:%=%$(PROGSSUF)_g$(EXESUF))
OBJS-ffmpeg += fftools/ffmpeg_opt.o fftools/ffmpeg_filter.o fftools/ffmpeg_hw.o
OBJS-ffmpeg-$(CONFIG_LIBMFX) += fftools/ffmpeg_qsv.o
ifndef CONFIG_VIDEOTOOLBOX
OBJS-ffmpeg-$(CONFIG_VDA) += fftools/ffmpeg_videotoolbox.o
endif
OBJS-ffmpeg-$(CONFIG_VIDEOTOOLBOX) += fftools/ffmpeg_videotoolbox.o
OBJS-ffmpeg += \
fftools/ffmpeg_filter.o \
fftools/ffmpeg_hw.o \
fftools/ffmpeg_mux.o \
fftools/ffmpeg_opt.o \
define DOFFTOOL
OBJS-$(1) += fftools/cmdutils.o fftools/$(1).o $(OBJS-$(1)-yes)
OBJS-$(1) += fftools/cmdutils.o fftools/opt_common.o fftools/$(1).o $(OBJS-$(1)-yes)
$(1)$(PROGSSUF)_g$(EXESUF): $$(OBJS-$(1))
$$(OBJS-$(1)): | fftools
$$(OBJS-$(1)): CFLAGS += $(CFLAGS-$(1))

File diff suppressed because it is too large Load Diff

View File

@ -44,11 +44,9 @@ extern const char program_name[];
*/
extern const int program_birth_year;
extern AVCodecContext *avcodec_opts[AVMEDIA_TYPE_NB];
extern AVFormatContext *avformat_opts;
extern AVDictionary *sws_dict;
extern AVDictionary *swr_opts;
extern AVDictionary *format_opts, *codec_opts, *resample_opts;
extern AVDictionary *format_opts, *codec_opts;
extern int hide_banner;
/**
@ -66,11 +64,6 @@ void exit_program(int ret) av_noreturn;
*/
void init_dynload(void);
/**
* Initialize the cmdutils option system, in particular
* allocate the *_opts contexts.
*/
void init_opts(void);
/**
* Uninitialize the cmdutils option system, in particular
* free the *_opts contexts and their contents.
@ -83,28 +76,12 @@ void uninit_opts(void);
*/
void log_callback_help(void* ptr, int level, const char* fmt, va_list vl);
/**
* Override the cpuflags.
*/
int opt_cpuflags(void *optctx, const char *opt, const char *arg);
/**
* Fallback for options that are not explicitly handled, these will be
* parsed through AVOptions.
*/
int opt_default(void *optctx, const char *opt, const char *arg);
/**
* Set the libav* libraries log level.
*/
int opt_loglevel(void *optctx, const char *opt, const char *arg);
int opt_report(void *optctx, const char *opt, const char *arg);
int opt_max_alloc(void *optctx, const char *opt, const char *arg);
int opt_codec_debug(void *optctx, const char *opt, const char *arg);
/**
* Limit the execution time.
*/
@ -201,47 +178,6 @@ typedef struct OptionDef {
void show_help_options(const OptionDef *options, const char *msg, int req_flags,
int rej_flags, int alt_flags);
#if CONFIG_AVDEVICE
#define CMDUTILS_COMMON_OPTIONS_AVDEVICE \
{ "sources" , OPT_EXIT | HAS_ARG, { .func_arg = show_sources }, \
"list sources of the input device", "device" }, \
{ "sinks" , OPT_EXIT | HAS_ARG, { .func_arg = show_sinks }, \
"list sinks of the output device", "device" }, \
#else
#define CMDUTILS_COMMON_OPTIONS_AVDEVICE
#endif
#define CMDUTILS_COMMON_OPTIONS \
{ "L", OPT_EXIT, { .func_arg = show_license }, "show license" }, \
{ "h", OPT_EXIT, { .func_arg = show_help }, "show help", "topic" }, \
{ "?", OPT_EXIT, { .func_arg = show_help }, "show help", "topic" }, \
{ "help", OPT_EXIT, { .func_arg = show_help }, "show help", "topic" }, \
{ "-help", OPT_EXIT, { .func_arg = show_help }, "show help", "topic" }, \
{ "version", OPT_EXIT, { .func_arg = show_version }, "show version" }, \
{ "buildconf", OPT_EXIT, { .func_arg = show_buildconf }, "show build configuration" }, \
{ "formats", OPT_EXIT, { .func_arg = show_formats }, "show available formats" }, \
{ "muxers", OPT_EXIT, { .func_arg = show_muxers }, "show available muxers" }, \
{ "demuxers", OPT_EXIT, { .func_arg = show_demuxers }, "show available demuxers" }, \
{ "devices", OPT_EXIT, { .func_arg = show_devices }, "show available devices" }, \
{ "codecs", OPT_EXIT, { .func_arg = show_codecs }, "show available codecs" }, \
{ "decoders", OPT_EXIT, { .func_arg = show_decoders }, "show available decoders" }, \
{ "encoders", OPT_EXIT, { .func_arg = show_encoders }, "show available encoders" }, \
{ "bsfs", OPT_EXIT, { .func_arg = show_bsfs }, "show available bit stream filters" }, \
{ "protocols", OPT_EXIT, { .func_arg = show_protocols }, "show available protocols" }, \
{ "filters", OPT_EXIT, { .func_arg = show_filters }, "show available filters" }, \
{ "pix_fmts", OPT_EXIT, { .func_arg = show_pix_fmts }, "show available pixel formats" }, \
{ "layouts", OPT_EXIT, { .func_arg = show_layouts }, "show standard channel layouts" }, \
{ "sample_fmts", OPT_EXIT, { .func_arg = show_sample_fmts }, "show available audio sample formats" }, \
{ "colors", OPT_EXIT, { .func_arg = show_colors }, "show available color names" }, \
{ "loglevel", HAS_ARG, { .func_arg = opt_loglevel }, "set logging level", "loglevel" }, \
{ "v", HAS_ARG, { .func_arg = opt_loglevel }, "set logging level", "loglevel" }, \
{ "report", 0, { .func_arg = opt_report }, "generate a report" }, \
{ "max_alloc", HAS_ARG, { .func_arg = opt_max_alloc }, "set maximum size of a single allocated block", "bytes" }, \
{ "cpuflags", HAS_ARG | OPT_EXPERT, { .func_arg = opt_cpuflags }, "force specific cpu flags", "flags" }, \
{ "hide_banner", OPT_BOOL | OPT_EXPERT, {&hide_banner}, "do not show program banner", "hide_banner" }, \
CMDUTILS_COMMON_OPTIONS_AVDEVICE \
/**
* Show help for all options with given flags in class and all its
* children.
@ -254,11 +190,6 @@ void show_help_children(const AVClass *class, int flags);
*/
void show_help_default(const char *opt, const char *arg);
/**
* Generic -h handler common to all fftools.
*/
int show_help(void *optctx, const char *opt, const char *arg);
/**
* Parse the command line arguments.
*
@ -317,7 +248,6 @@ typedef struct OptionGroup {
AVDictionary *codec_opts;
AVDictionary *format_opts;
AVDictionary *resample_opts;
AVDictionary *sws_dict;
AVDictionary *swr_opts;
} OptionGroup;
@ -424,8 +354,8 @@ AVDictionary *filter_codec_opts(AVDictionary *opts, enum AVCodecID codec_id,
* Each dictionary will contain the options from codec_opts which can
* be applied to the corresponding stream codec context.
*
* @return pointer to the created array of dictionaries, NULL if it
* cannot be created
* @return pointer to the created array of dictionaries.
* Calls exit() on failure.
*/
AVDictionary **setup_find_stream_info_opts(AVFormatContext *s,
AVDictionary *codec_opts);
@ -448,136 +378,6 @@ void print_error(const char *filename, int err);
*/
void show_banner(int argc, char **argv, const OptionDef *options);
/**
* Print the version of the program to stdout. The version message
* depends on the current versions of the repository and of the libav*
* libraries.
* This option processing function does not utilize the arguments.
*/
int show_version(void *optctx, const char *opt, const char *arg);
/**
* Print the build configuration of the program to stdout. The contents
* depend on the definition of FFMPEG_CONFIGURATION.
* This option processing function does not utilize the arguments.
*/
int show_buildconf(void *optctx, const char *opt, const char *arg);
/**
* Print the license of the program to stdout. The license depends on
* the license of the libraries compiled into the program.
* This option processing function does not utilize the arguments.
*/
int show_license(void *optctx, const char *opt, const char *arg);
/**
* Print a listing containing all the formats supported by the
* program (including devices).
* This option processing function does not utilize the arguments.
*/
int show_formats(void *optctx, const char *opt, const char *arg);
/**
* Print a listing containing all the muxers supported by the
* program (including devices).
* This option processing function does not utilize the arguments.
*/
int show_muxers(void *optctx, const char *opt, const char *arg);
/**
* Print a listing containing all the demuxer supported by the
* program (including devices).
* This option processing function does not utilize the arguments.
*/
int show_demuxers(void *optctx, const char *opt, const char *arg);
/**
* Print a listing containing all the devices supported by the
* program.
* This option processing function does not utilize the arguments.
*/
int show_devices(void *optctx, const char *opt, const char *arg);
#if CONFIG_AVDEVICE
/**
* Print a listing containing autodetected sinks of the output device.
* Device name with options may be passed as an argument to limit results.
*/
int show_sinks(void *optctx, const char *opt, const char *arg);
/**
* Print a listing containing autodetected sources of the input device.
* Device name with options may be passed as an argument to limit results.
*/
int show_sources(void *optctx, const char *opt, const char *arg);
#endif
/**
* Print a listing containing all the codecs supported by the
* program.
* This option processing function does not utilize the arguments.
*/
int show_codecs(void *optctx, const char *opt, const char *arg);
/**
* Print a listing containing all the decoders supported by the
* program.
*/
int show_decoders(void *optctx, const char *opt, const char *arg);
/**
* Print a listing containing all the encoders supported by the
* program.
*/
int show_encoders(void *optctx, const char *opt, const char *arg);
/**
* Print a listing containing all the filters supported by the
* program.
* This option processing function does not utilize the arguments.
*/
int show_filters(void *optctx, const char *opt, const char *arg);
/**
* Print a listing containing all the bit stream filters supported by the
* program.
* This option processing function does not utilize the arguments.
*/
int show_bsfs(void *optctx, const char *opt, const char *arg);
/**
* Print a listing containing all the protocols supported by the
* program.
* This option processing function does not utilize the arguments.
*/
int show_protocols(void *optctx, const char *opt, const char *arg);
/**
* Print a listing containing all the pixel formats supported by the
* program.
* This option processing function does not utilize the arguments.
*/
int show_pix_fmts(void *optctx, const char *opt, const char *arg);
/**
* Print a listing containing all the standard channel layouts supported by
* the program.
* This option processing function does not utilize the arguments.
*/
int show_layouts(void *optctx, const char *opt, const char *arg);
/**
* Print a listing containing all the sample formats supported by the
* program.
*/
int show_sample_fmts(void *optctx, const char *opt, const char *arg);
/**
* Print a listing containing all the color names and values recognized
* by the program.
*/
int show_colors(void *optctx, const char *opt, const char *arg);
/**
* Return a positive value if a line read from standard input
* starts with [yY], otherwise return 0.
@ -617,11 +417,26 @@ FILE *get_preset_file(char *filename, size_t filename_size,
*/
void *grow_array(void *array, int elem_size, int *size, int new_size);
#define media_type_string av_get_media_type_string
/**
* Atomically add a new element to an array of pointers, i.e. allocate
* a new entry, reallocate the array of pointers and make the new last
* member of this array point to the newly allocated buffer.
* Calls exit() on failure.
*
* @param array array of pointers to reallocate
* @param elem_size size of the new element to allocate
* @param nb_elems pointer to the number of elements of the array array;
* *nb_elems will be incremented by one by this function.
* @return pointer to the newly allocated entry
*/
void *allocate_array_elem(void *array, size_t elem_size, int *nb_elems);
#define GROW_ARRAY(array, nb_elems)\
array = grow_array(array, sizeof(*array), &nb_elems, nb_elems + 1)
#define ALLOC_ARRAY_ELEM(array, nb_elems)\
allocate_array_elem(&array, sizeof(*array[0]), &nb_elems)
#define GET_PIX_FMT_NAME(pix_fmt)\
const char *name = av_get_pix_fmt_name(pix_fmt);
@ -635,14 +450,6 @@ void *grow_array(void *array, int elem_size, int *size, int new_size);
char name[16];\
snprintf(name, sizeof(name), "%d", rate);
#define GET_CH_LAYOUT_NAME(ch_layout)\
char name[16];\
snprintf(name, sizeof(name), "0x%"PRIx64, ch_layout);
#define GET_CH_LAYOUT_DESC(ch_layout)\
char name[128];\
av_get_channel_layout_string(name, sizeof(name), 0, ch_layout);
double get_rotation(AVStream *st);
double get_rotation(int32_t *displaymatrix);
#endif /* FFTOOLS_CMDUTILS_H */

File diff suppressed because it is too large Load Diff

View File

@ -31,6 +31,7 @@
#include "libavformat/avio.h"
#include "libavcodec/avcodec.h"
#include "libavcodec/bsf.h"
#include "libavfilter/avfilter.h"
@ -46,12 +47,14 @@
#include "libswresample/swresample.h"
#define VSYNC_AUTO -1
#define VSYNC_PASSTHROUGH 0
#define VSYNC_CFR 1
#define VSYNC_VFR 2
#define VSYNC_VSCFR 0xfe
#define VSYNC_DROP 0xff
enum VideoSyncMethod {
VSYNC_AUTO = -1,
VSYNC_PASSTHROUGH,
VSYNC_CFR,
VSYNC_VFR,
VSYNC_VSCFR,
VSYNC_DROP,
};
#define MAX_STREAMS 1024 /* arbitrary sanity check value */
@ -59,17 +62,8 @@ enum HWAccelID {
HWACCEL_NONE = 0,
HWACCEL_AUTO,
HWACCEL_GENERIC,
HWACCEL_VIDEOTOOLBOX,
HWACCEL_QSV,
};
typedef struct HWAccel {
const char *name;
int (*init)(AVCodecContext *s);
enum HWAccelID id;
enum AVPixelFormat pix_fmt;
} HWAccel;
typedef struct HWDevice {
const char *name;
enum AVHWDeviceType type;
@ -102,6 +96,8 @@ typedef struct OptionsContext {
SpecifierOpt *codec_names;
int nb_codec_names;
SpecifierOpt *audio_ch_layouts;
int nb_audio_ch_layouts;
SpecifierOpt *audio_channels;
int nb_audio_channels;
SpecifierOpt *audio_sample_rate;
@ -119,8 +115,10 @@ typedef struct OptionsContext {
int64_t input_ts_offset;
int loop;
int rate_emu;
float readrate;
int accurate_seek;
int thread_queue_size;
int input_sync_ref;
SpecifierOpt *ts_scale;
int nb_ts_scale;
@ -179,6 +177,8 @@ typedef struct OptionsContext {
int nb_qscale;
SpecifierOpt *forced_key_frames;
int nb_forced_key_frames;
SpecifierOpt *fps_mode;
int nb_fps_mode;
SpecifierOpt *force_fps;
int nb_force_fps;
SpecifierOpt *frame_aspect_ratios;
@ -235,6 +235,8 @@ typedef struct OptionsContext {
int nb_enc_time_bases;
SpecifierOpt *autoscale;
int nb_autoscale;
SpecifierOpt *bits_per_raw_sample;
int nb_bits_per_raw_sample;
} OptionsContext;
typedef struct InputFilter {
@ -244,7 +246,7 @@ typedef struct InputFilter {
uint8_t *name;
enum AVMediaType type; // AVMEDIA_TYPE_SUBTITLE for sub2video
AVFifoBuffer *frame_queue;
AVFifo *frame_queue;
// parameters configured for this input
int format;
@ -253,10 +255,10 @@ typedef struct InputFilter {
AVRational sample_aspect_ratio;
int sample_rate;
int channels;
uint64_t channel_layout;
AVChannelLayout ch_layout;
AVBufferRef *hw_frames_ctx;
int32_t *displaymatrix;
int eof;
} InputFilter;
@ -276,12 +278,13 @@ typedef struct OutputFilter {
AVRational frame_rate;
int format;
int sample_rate;
uint64_t channel_layout;
AVChannelLayout ch_layout;
// those are only set if no format is specified and the encoder gives us multiple options
int *formats;
uint64_t *channel_layouts;
int *sample_rates;
// They point directly to the relevant lists of the encoder.
const int *formats;
const AVChannelLayout *ch_layouts;
const int *sample_rates;
} OutputFilter;
typedef struct FilterGraph {
@ -290,6 +293,9 @@ typedef struct FilterGraph {
AVFilterGraph *graph;
int reconfiguration;
// true when the filtergraph contains only meta filters
// that do not modify the frame data
int is_meta;
InputFilter **inputs;
int nb_inputs;
@ -305,17 +311,19 @@ typedef struct InputStream {
int decoding_needed; /* non zero if the packets must be decoded in 'raw_fifo', see DECODING_FOR_* */
#define DECODING_FOR_OST 1
#define DECODING_FOR_FILTER 2
int processing_needed; /* non zero if the packets must be processed */
AVCodecContext *dec_ctx;
const AVCodec *dec;
AVFrame *decoded_frame;
AVFrame *filter_frame; /* a ref of decoded_frame, to be sent to filters */
AVPacket *pkt;
int64_t prev_pkt_pts;
int64_t start; /* time when read started */
/* predicted dts of the next packet read for this stream or (when there are
* several frames in a packet) of the next frame in current packet (in AV_TIME_BASE units) */
int64_t next_dts;
int64_t first_dts; ///< dts of the first packet read for this stream (in AV_TIME_BASE units)
int64_t dts; ///< dts of the last packet read for this stream (in AV_TIME_BASE units)
int64_t next_pts; ///< synthetic pts for the next decode frame (in AV_TIME_BASE units)
@ -352,14 +360,12 @@ typedef struct InputStream {
struct sub2video {
int64_t last_pts;
int64_t end_pts;
AVFifoBuffer *sub_queue; ///< queue of AVSubtitle* before filter init
AVFifo *sub_queue; ///< queue of AVSubtitle* before filter init
AVFrame *frame;
int w, h;
unsigned int initialize; ///< marks if sub2video_update should force an initialization
} sub2video;
int dr1;
/* decoded data from this stream goes into all those filters
* currently video and audio only */
InputFilter **filters;
@ -376,11 +382,9 @@ typedef struct InputStream {
/* hwaccel context */
void *hwaccel_ctx;
void (*hwaccel_uninit)(AVCodecContext *s);
int (*hwaccel_get_buffer)(AVCodecContext *s, AVFrame *frame, int flags);
int (*hwaccel_retrieve_data)(AVCodecContext *s, AVFrame *frame);
enum AVPixelFormat hwaccel_pix_fmt;
enum AVPixelFormat hwaccel_retrieved_pix_fmt;
AVBufferRef *hw_frames_ctx;
/* stats */
// combined size of all the packets read
@ -407,16 +411,17 @@ typedef struct InputFile {
at the moment when looping happens */
AVRational time_base; /* time base of the duration */
int64_t input_ts_offset;
int input_sync_ref;
int64_t ts_offset;
int64_t last_ts;
int64_t start_time; /* user-specified start time in AV_TIME_BASE or AV_NOPTS_VALUE */
int seek_timestamp;
int64_t recording_time;
int nb_streams; /* number of stream that ffmpeg is aware of; may be different
from ctx.nb_streams if new streams appear during av_read_frame() */
int nb_streams_warn; /* number of streams that the user was warned of */
int rate_emu;
float readrate;
int accurate_seek;
AVPacket *pkt;
@ -455,7 +460,7 @@ typedef struct OutputStream {
int source_index; /* InputStream index */
AVStream *st; /* stream in the output file */
int encoding_needed; /* true if encoding needed for this stream */
int frame_number;
int64_t frame_number;
/* input pts and corresponding output pts
for A/V sync */
struct InputStream *sync_ist; /* input stream to sync against */
@ -478,19 +483,22 @@ typedef struct OutputStream {
AVFrame *filtered_frame;
AVFrame *last_frame;
AVPacket *pkt;
int last_dropped;
int last_nb0_frames[3];
int64_t last_dropped;
int64_t last_nb0_frames[3];
void *hwaccel_ctx;
/* video only */
AVRational frame_rate;
AVRational max_frame_rate;
enum VideoSyncMethod vsync_method;
int is_cfr;
const char *fps_mode;
int force_fps;
int top_field_first;
int rotate_overridden;
int autoscale;
int bits_per_raw_sample;
double rotate_override_value;
AVRational frame_aspect_ratio;
@ -503,6 +511,7 @@ typedef struct OutputStream {
char *forced_keyframes;
AVExpr *forced_keyframes_pexpr;
double forced_keyframes_expr_const_values[FKF_NB];
int dropped_keyframe;
/* audio only */
int *audio_channels_map; /* list of the channels id to pick from the source stream */
@ -519,7 +528,6 @@ typedef struct OutputStream {
AVDictionary *encoder_opts;
AVDictionary *sws_dict;
AVDictionary *swr_opts;
AVDictionary *resample_opts;
char *apad;
OSTFinished finished; /* no more packets should be written for this stream */
int unavailable; /* true if the steram is unavailable (possibly temporarily) */
@ -533,6 +541,7 @@ typedef struct OutputStream {
int inputs_done;
const char *attachment_filename;
int streamcopy_started;
int copy_initial_nonkeyframes;
int copy_prior_start;
char *disposition;
@ -547,6 +556,8 @@ typedef struct OutputStream {
// number of frames/samples sent to the encoder
uint64_t frames_encoded;
uint64_t samples_encoded;
// number of packets received from the encoder
uint64_t packets_encoded;
/* packet quality factor */
int quality;
@ -554,7 +565,7 @@ typedef struct OutputStream {
int max_muxing_queue_size;
/* the packets are buffered here until the muxer is ready to be initialized */
AVFifoBuffer *muxing_queue;
AVFifo *muxing_queue;
/*
* The size of the AVPackets' buffers in queue.
@ -573,6 +584,10 @@ typedef struct OutputStream {
} OutputStream;
typedef struct OutputFile {
int index;
const AVOutputFormat *format;
AVFormatContext *ctx;
AVDictionary *opts;
int ost_index; /* index of the first stream in output_streams */
@ -607,7 +622,7 @@ extern float dts_error_threshold;
extern int audio_volume;
extern int audio_sync_method;
extern int video_sync_method;
extern enum VideoSyncMethod video_sync_method;
extern float frame_drop_threshold;
extern int do_benchmark;
extern int do_benchmark_all;
@ -627,9 +642,8 @@ extern int stdin_interaction;
extern int frame_bits_per_raw_sample;
extern AVIOContext *progress_avio;
extern float max_error_rate;
extern char *videotoolbox_pixfmt;
extern int filter_nbthreads;
extern char *filter_nbthreads;
extern int filter_complex_nbthreads;
extern int vstats_version;
extern int auto_conversion_filters;
@ -637,12 +651,15 @@ extern int auto_conversion_filters;
extern const AVIOInterruptCB int_cb;
extern const OptionDef options[];
extern const HWAccel hwaccels[];
#if CONFIG_QSV
extern char *qsv_device;
#endif
extern HWDevice *filter_hw_device;
extern int want_sdp;
extern unsigned nb_output_dumped;
extern int main_return_code;
void term_init(void);
void term_exit(void);
@ -679,4 +696,12 @@ int hw_device_setup_for_filter(FilterGraph *fg);
int hwaccel_decode_init(AVCodecContext *avctx);
/* open the muxer when all the streams are initialized */
int of_check_init(OutputFile *of);
int of_write_trailer(OutputFile *of);
void of_close(OutputFile **pof);
void of_write_packet(OutputFile *of, AVPacket *pkt, OutputStream *ost,
int unqueue);
#endif /* FFTOOLS_FFMPEG_H */

View File

@ -26,8 +26,6 @@
#include "libavfilter/buffersink.h"
#include "libavfilter/buffersrc.h"
#include "libavresample/avresample.h"
#include "libavutil/avassert.h"
#include "libavutil/avstring.h"
#include "libavutil/bprint.h"
@ -39,22 +37,16 @@
#include "libavutil/imgutils.h"
#include "libavutil/samplefmt.h"
static const enum AVPixelFormat *get_compliance_unofficial_pix_fmts(enum AVCodecID codec_id, const enum AVPixelFormat default_formats[])
// FIXME: YUV420P etc. are actually supported with full color range,
// yet the latter information isn't available here.
static const enum AVPixelFormat *get_compliance_normal_pix_fmts(const AVCodec *codec, const enum AVPixelFormat default_formats[])
{
static const enum AVPixelFormat mjpeg_formats[] =
{ AV_PIX_FMT_YUVJ420P, AV_PIX_FMT_YUVJ422P, AV_PIX_FMT_YUVJ444P,
AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUV422P, AV_PIX_FMT_YUV444P,
AV_PIX_FMT_NONE };
static const enum AVPixelFormat ljpeg_formats[] =
{ AV_PIX_FMT_BGR24 , AV_PIX_FMT_BGRA , AV_PIX_FMT_BGR0,
AV_PIX_FMT_YUVJ420P, AV_PIX_FMT_YUVJ444P, AV_PIX_FMT_YUVJ422P,
AV_PIX_FMT_YUV420P , AV_PIX_FMT_YUV444P , AV_PIX_FMT_YUV422P,
AV_PIX_FMT_NONE};
if (codec_id == AV_CODEC_ID_MJPEG) {
if (!strcmp(codec->name, "mjpeg")) {
return mjpeg_formats;
} else if (codec_id == AV_CODEC_ID_LJPEG) {
return ljpeg_formats;
} else {
return default_formats;
}
@ -70,8 +62,8 @@ static enum AVPixelFormat choose_pixel_fmt(AVStream *st, AVCodecContext *enc_ctx
int has_alpha = desc ? desc->nb_components % 2 == 0 : 0;
enum AVPixelFormat best= AV_PIX_FMT_NONE;
if (enc_ctx->strict_std_compliance <= FF_COMPLIANCE_UNOFFICIAL) {
p = get_compliance_unofficial_pix_fmts(enc_ctx->codec_id, p);
if (enc_ctx->strict_std_compliance > FF_COMPLIANCE_UNOFFICIAL) {
p = get_compliance_normal_pix_fmts(codec, p);
}
for (; *p != AV_PIX_FMT_NONE; p++) {
best = av_find_best_pix_fmt_of_2(best, *p, target, has_alpha, NULL);
@ -91,10 +83,13 @@ static enum AVPixelFormat choose_pixel_fmt(AVStream *st, AVCodecContext *enc_ctx
return target;
}
static char *choose_pix_fmts(OutputFilter *ofilter)
/* May return NULL (no pixel format found), a static string or a string
* backed by the bprint. Nothing has been written to the AVBPrint in case
* NULL is returned. The AVBPrint provided should be clean. */
static const char *choose_pix_fmts(OutputFilter *ofilter, AVBPrint *bprint)
{
OutputStream *ost = ofilter->ost;
AVDictionaryEntry *strict_dict = av_dict_get(ost->encoder_opts, "strict", NULL, 0);
const AVDictionaryEntry *strict_dict = av_dict_get(ost->encoder_opts, "strict", NULL, 0);
if (strict_dict)
// used by choose_pixel_fmt() and below
av_opt_set(ost->enc_ctx, "strict", strict_dict->value, 0);
@ -104,105 +99,108 @@ static char *choose_pix_fmts(OutputFilter *ofilter)
AVFILTER_AUTO_CONVERT_NONE);
if (ost->enc_ctx->pix_fmt == AV_PIX_FMT_NONE)
return NULL;
return av_strdup(av_get_pix_fmt_name(ost->enc_ctx->pix_fmt));
return av_get_pix_fmt_name(ost->enc_ctx->pix_fmt);
}
if (ost->enc_ctx->pix_fmt != AV_PIX_FMT_NONE) {
return av_strdup(av_get_pix_fmt_name(choose_pixel_fmt(ost->st, ost->enc_ctx, ost->enc, ost->enc_ctx->pix_fmt)));
return av_get_pix_fmt_name(choose_pixel_fmt(ost->st, ost->enc_ctx, ost->enc, ost->enc_ctx->pix_fmt));
} else if (ost->enc && ost->enc->pix_fmts) {
const enum AVPixelFormat *p;
AVIOContext *s = NULL;
uint8_t *ret;
int len;
if (avio_open_dyn_buf(&s) < 0)
exit_program(1);
p = ost->enc->pix_fmts;
if (ost->enc_ctx->strict_std_compliance <= FF_COMPLIANCE_UNOFFICIAL) {
p = get_compliance_unofficial_pix_fmts(ost->enc_ctx->codec_id, p);
if (ost->enc_ctx->strict_std_compliance > FF_COMPLIANCE_UNOFFICIAL) {
p = get_compliance_normal_pix_fmts(ost->enc, p);
}
for (; *p != AV_PIX_FMT_NONE; p++) {
const char *name = av_get_pix_fmt_name(*p);
avio_printf(s, "%s|", name);
av_bprintf(bprint, "%s%c", name, p[1] == AV_PIX_FMT_NONE ? '\0' : '|');
}
len = avio_close_dyn_buf(s, &ret);
ret[len - 1] = 0;
return ret;
if (!av_bprint_is_complete(bprint))
exit_program(1);
return bprint->str;
} else
return NULL;
}
/* Define a function for building a string containing a list of
* allowed formats. */
#define DEF_CHOOSE_FORMAT(suffix, type, var, supported_list, none, get_name) \
static char *choose_ ## suffix (OutputFilter *ofilter) \
/* Define a function for appending a list of allowed formats
* to an AVBPrint. If nonempty, the list will have a header. */
#define DEF_CHOOSE_FORMAT(name, type, var, supported_list, none, printf_format, get_name) \
static void choose_ ## name (OutputFilter *ofilter, AVBPrint *bprint) \
{ \
if (ofilter->var == none && !ofilter->supported_list) \
return; \
av_bprintf(bprint, #name "="); \
if (ofilter->var != none) { \
get_name(ofilter->var); \
return av_strdup(name); \
} else if (ofilter->supported_list) { \
av_bprintf(bprint, printf_format, get_name(ofilter->var)); \
} else { \
const type *p; \
AVIOContext *s = NULL; \
uint8_t *ret; \
int len; \
\
if (avio_open_dyn_buf(&s) < 0) \
exit_program(1); \
\
for (p = ofilter->supported_list; *p != none; p++) { \
get_name(*p); \
avio_printf(s, "%s|", name); \
av_bprintf(bprint, printf_format "|", get_name(*p)); \
} \
len = avio_close_dyn_buf(s, &ret); \
ret[len - 1] = 0; \
return ret; \
} else \
return NULL; \
if (bprint->len > 0) \
bprint->str[--bprint->len] = '\0'; \
} \
av_bprint_chars(bprint, ':', 1); \
}
//DEF_CHOOSE_FORMAT(pix_fmts, enum AVPixelFormat, format, formats, AV_PIX_FMT_NONE,
// GET_PIX_FMT_NAME)
DEF_CHOOSE_FORMAT(sample_fmts, enum AVSampleFormat, format, formats,
AV_SAMPLE_FMT_NONE, GET_SAMPLE_FMT_NAME)
AV_SAMPLE_FMT_NONE, "%s", av_get_sample_fmt_name)
DEF_CHOOSE_FORMAT(sample_rates, int, sample_rate, sample_rates, 0,
GET_SAMPLE_RATE_NAME)
"%d", )
DEF_CHOOSE_FORMAT(channel_layouts, uint64_t, channel_layout, channel_layouts, 0,
GET_CH_LAYOUT_NAME)
static void choose_channel_layouts(OutputFilter *ofilter, AVBPrint *bprint)
{
if (av_channel_layout_check(&ofilter->ch_layout)) {
av_bprintf(bprint, "channel_layouts=");
av_channel_layout_describe_bprint(&ofilter->ch_layout, bprint);
} else if (ofilter->ch_layouts) {
const AVChannelLayout *p;
av_bprintf(bprint, "channel_layouts=");
for (p = ofilter->ch_layouts; p->nb_channels; p++) {
av_channel_layout_describe_bprint(p, bprint);
av_bprintf(bprint, "|");
}
if (bprint->len > 0)
bprint->str[--bprint->len] = '\0';
} else
return;
av_bprint_chars(bprint, ':', 1);
}
int init_simple_filtergraph(InputStream *ist, OutputStream *ost)
{
FilterGraph *fg = av_mallocz(sizeof(*fg));
OutputFilter *ofilter;
InputFilter *ifilter;
if (!fg)
exit_program(1);
fg->index = nb_filtergraphs;
GROW_ARRAY(fg->outputs, fg->nb_outputs);
if (!(fg->outputs[0] = av_mallocz(sizeof(*fg->outputs[0]))))
exit_program(1);
fg->outputs[0]->ost = ost;
fg->outputs[0]->graph = fg;
fg->outputs[0]->format = -1;
ofilter = ALLOC_ARRAY_ELEM(fg->outputs, fg->nb_outputs);
ofilter->ost = ost;
ofilter->graph = fg;
ofilter->format = -1;
ost->filter = fg->outputs[0];
ost->filter = ofilter;
GROW_ARRAY(fg->inputs, fg->nb_inputs);
if (!(fg->inputs[0] = av_mallocz(sizeof(*fg->inputs[0]))))
exit_program(1);
fg->inputs[0]->ist = ist;
fg->inputs[0]->graph = fg;
fg->inputs[0]->format = -1;
ifilter = ALLOC_ARRAY_ELEM(fg->inputs, fg->nb_inputs);
ifilter->ist = ist;
ifilter->graph = fg;
ifilter->format = -1;
fg->inputs[0]->frame_queue = av_fifo_alloc(8 * sizeof(AVFrame*));
if (!fg->inputs[0]->frame_queue)
ifilter->frame_queue = av_fifo_alloc2(8, sizeof(AVFrame*), AV_FIFO_FLAG_AUTO_GROW);
if (!ifilter->frame_queue)
exit_program(1);
GROW_ARRAY(ist->filters, ist->nb_filters);
ist->filters[ist->nb_filters - 1] = fg->inputs[0];
ist->filters[ist->nb_filters - 1] = ifilter;
GROW_ARRAY(filtergraphs, nb_filtergraphs);
filtergraphs[nb_filtergraphs - 1] = fg;
@ -215,17 +213,15 @@ static char *describe_filter_link(FilterGraph *fg, AVFilterInOut *inout, int in)
AVFilterContext *ctx = inout->filter_ctx;
AVFilterPad *pads = in ? ctx->input_pads : ctx->output_pads;
int nb_pads = in ? ctx->nb_inputs : ctx->nb_outputs;
AVIOContext *pb;
uint8_t *res = NULL;
char *res;
if (avio_open_dyn_buf(&pb) < 0)
exit_program(1);
avio_printf(pb, "%s", ctx->filter->name);
if (nb_pads > 1)
avio_printf(pb, ":%s", avfilter_pad_get_name(pads, inout->pad_idx));
avio_w8(pb, 0);
avio_close_dyn_buf(pb, &res);
res = av_strdup(ctx->filter->name);
else
res = av_asprintf("%s:%s", ctx->filter->name,
avfilter_pad_get_name(pads, inout->pad_idx));
if (!res)
exit_program(1);
return res;
}
@ -233,6 +229,7 @@ static void init_input_filter(FilterGraph *fg, AVFilterInOut *in)
{
InputStream *ist = NULL;
enum AVMediaType type = avfilter_pad_get_type(in->filter_ctx->input_pads, in->pad_idx);
InputFilter *ifilter;
int i;
// TODO: support other filter types
@ -297,23 +294,22 @@ static void init_input_filter(FilterGraph *fg, AVFilterInOut *in)
ist->discard = 0;
ist->decoding_needed |= DECODING_FOR_FILTER;
ist->processing_needed = 1;
ist->st->discard = AVDISCARD_NONE;
GROW_ARRAY(fg->inputs, fg->nb_inputs);
if (!(fg->inputs[fg->nb_inputs - 1] = av_mallocz(sizeof(*fg->inputs[0]))))
exit_program(1);
fg->inputs[fg->nb_inputs - 1]->ist = ist;
fg->inputs[fg->nb_inputs - 1]->graph = fg;
fg->inputs[fg->nb_inputs - 1]->format = -1;
fg->inputs[fg->nb_inputs - 1]->type = ist->st->codecpar->codec_type;
fg->inputs[fg->nb_inputs - 1]->name = describe_filter_link(fg, in, 1);
ifilter = ALLOC_ARRAY_ELEM(fg->inputs, fg->nb_inputs);
ifilter->ist = ist;
ifilter->graph = fg;
ifilter->format = -1;
ifilter->type = ist->st->codecpar->codec_type;
ifilter->name = describe_filter_link(fg, in, 1);
fg->inputs[fg->nb_inputs - 1]->frame_queue = av_fifo_alloc(8 * sizeof(AVFrame*));
if (!fg->inputs[fg->nb_inputs - 1]->frame_queue)
ifilter->frame_queue = av_fifo_alloc2(8, sizeof(AVFrame*), AV_FIFO_FLAG_AUTO_GROW);
if (!ifilter->frame_queue)
exit_program(1);
GROW_ARRAY(ist->filters, ist->nb_filters);
ist->filters[ist->nb_filters - 1] = fg->inputs[fg->nb_inputs - 1];
ist->filters[ist->nb_filters - 1] = ifilter;
}
int init_complex_filtergraph(FilterGraph *fg)
@ -337,18 +333,15 @@ int init_complex_filtergraph(FilterGraph *fg)
init_input_filter(fg, cur);
for (cur = outputs; cur;) {
GROW_ARRAY(fg->outputs, fg->nb_outputs);
fg->outputs[fg->nb_outputs - 1] = av_mallocz(sizeof(*fg->outputs[0]));
if (!fg->outputs[fg->nb_outputs - 1])
exit_program(1);
OutputFilter *const ofilter = ALLOC_ARRAY_ELEM(fg->outputs, fg->nb_outputs);
fg->outputs[fg->nb_outputs - 1]->graph = fg;
fg->outputs[fg->nb_outputs - 1]->out_tmp = cur;
fg->outputs[fg->nb_outputs - 1]->type = avfilter_pad_get_type(cur->filter_ctx->output_pads,
ofilter->graph = fg;
ofilter->out_tmp = cur;
ofilter->type = avfilter_pad_get_type(cur->filter_ctx->output_pads,
cur->pad_idx);
fg->outputs[fg->nb_outputs - 1]->name = describe_filter_link(fg, cur, 0);
ofilter->name = describe_filter_link(fg, cur, 0);
cur = cur->next;
fg->outputs[fg->nb_outputs - 1]->out_tmp->next = NULL;
ofilter->out_tmp->next = NULL;
}
fail:
@ -432,12 +425,13 @@ static int insert_filter(AVFilterContext **last_filter, int *pad_idx,
static int configure_output_video_filter(FilterGraph *fg, OutputFilter *ofilter, AVFilterInOut *out)
{
char *pix_fmts;
OutputStream *ost = ofilter->ost;
OutputFile *of = output_files[ost->file_index];
AVFilterContext *last_filter = out->filter_ctx;
AVBPrint bprint;
int pad_idx = out->pad_idx;
int ret;
const char *pix_fmts;
char name[255];
snprintf(name, sizeof(name), "out_%d_%d", ost->file_index, ost->index);
@ -451,7 +445,7 @@ static int configure_output_video_filter(FilterGraph *fg, OutputFilter *ofilter,
if ((ofilter->width || ofilter->height) && ofilter->ost->autoscale) {
char args[255];
AVFilterContext *filter;
AVDictionaryEntry *e = NULL;
const AVDictionaryEntry *e = NULL;
snprintf(args, sizeof(args), "%d:%d",
ofilter->width, ofilter->height);
@ -473,14 +467,14 @@ static int configure_output_video_filter(FilterGraph *fg, OutputFilter *ofilter,
pad_idx = 0;
}
if ((pix_fmts = choose_pix_fmts(ofilter))) {
av_bprint_init(&bprint, 0, AV_BPRINT_SIZE_UNLIMITED);
if ((pix_fmts = choose_pix_fmts(ofilter, &bprint))) {
AVFilterContext *filter;
snprintf(name, sizeof(name), "format_out_%d_%d",
ost->file_index, ost->index);
ret = avfilter_graph_create_filter(&filter,
avfilter_get_by_name("format"),
"format", pix_fmts, NULL, fg->graph);
av_freep(&pix_fmts);
av_bprint_finalize(&bprint, NULL);
if (ret < 0)
return ret;
if ((ret = avfilter_link(last_filter, pad_idx, filter, 0)) < 0)
@ -531,7 +525,7 @@ static int configure_output_audio_filter(FilterGraph *fg, OutputFilter *ofilter,
AVCodecContext *codec = ost->enc_ctx;
AVFilterContext *last_filter = out->filter_ctx;
int pad_idx = out->pad_idx;
char *sample_fmts, *sample_rates, *channel_layouts;
AVBPrint args;
char name[255];
int ret;
@ -554,72 +548,59 @@ static int configure_output_audio_filter(FilterGraph *fg, OutputFilter *ofilter,
avfilter_get_by_name(filter_name), \
filter_name, arg, NULL, fg->graph); \
if (ret < 0) \
return ret; \
goto fail; \
\
ret = avfilter_link(last_filter, pad_idx, filt_ctx, 0); \
if (ret < 0) \
return ret; \
goto fail; \
\
last_filter = filt_ctx; \
pad_idx = 0; \
} while (0)
av_bprint_init(&args, 0, AV_BPRINT_SIZE_UNLIMITED);
if (ost->audio_channels_mapped) {
AVChannelLayout mapped_layout = { 0 };
int i;
AVBPrint pan_buf;
av_bprint_init(&pan_buf, 256, 8192);
av_bprintf(&pan_buf, "0x%"PRIx64,
av_get_default_channel_layout(ost->audio_channels_mapped));
av_channel_layout_default(&mapped_layout, ost->audio_channels_mapped);
av_channel_layout_describe_bprint(&mapped_layout, &args);
for (i = 0; i < ost->audio_channels_mapped; i++)
if (ost->audio_channels_map[i] != -1)
av_bprintf(&pan_buf, "|c%d=c%d", i, ost->audio_channels_map[i]);
av_bprintf(&args, "|c%d=c%d", i, ost->audio_channels_map[i]);
AUTO_INSERT_FILTER("-map_channel", "pan", pan_buf.str);
av_bprint_finalize(&pan_buf, NULL);
AUTO_INSERT_FILTER("-map_channel", "pan", args.str);
av_bprint_clear(&args);
}
if (codec->channels && !codec->channel_layout)
codec->channel_layout = av_get_default_channel_layout(codec->channels);
if (codec->ch_layout.order == AV_CHANNEL_ORDER_UNSPEC)
av_channel_layout_default(&codec->ch_layout, codec->ch_layout.nb_channels);
sample_fmts = choose_sample_fmts(ofilter);
sample_rates = choose_sample_rates(ofilter);
channel_layouts = choose_channel_layouts(ofilter);
if (sample_fmts || sample_rates || channel_layouts) {
choose_sample_fmts(ofilter, &args);
choose_sample_rates(ofilter, &args);
choose_channel_layouts(ofilter, &args);
if (!av_bprint_is_complete(&args)) {
ret = AVERROR(ENOMEM);
goto fail;
}
if (args.len) {
AVFilterContext *format;
char args[256];
args[0] = 0;
if (sample_fmts)
av_strlcatf(args, sizeof(args), "sample_fmts=%s:",
sample_fmts);
if (sample_rates)
av_strlcatf(args, sizeof(args), "sample_rates=%s:",
sample_rates);
if (channel_layouts)
av_strlcatf(args, sizeof(args), "channel_layouts=%s:",
channel_layouts);
av_freep(&sample_fmts);
av_freep(&sample_rates);
av_freep(&channel_layouts);
snprintf(name, sizeof(name), "format_out_%d_%d",
ost->file_index, ost->index);
ret = avfilter_graph_create_filter(&format,
avfilter_get_by_name("aformat"),
name, args, NULL, fg->graph);
name, args.str, NULL, fg->graph);
if (ret < 0)
return ret;
goto fail;
ret = avfilter_link(last_filter, pad_idx, format, 0);
if (ret < 0)
return ret;
goto fail;
last_filter = format;
pad_idx = 0;
}
if (ost->apad && of->shortest) {
char args[256];
int i;
for (i=0; i<of->ctx->nb_streams; i++)
@ -627,8 +608,7 @@ static int configure_output_audio_filter(FilterGraph *fg, OutputFilter *ofilter,
break;
if (i<of->ctx->nb_streams) {
snprintf(args, sizeof(args), "%s", ost->apad);
AUTO_INSERT_FILTER("-apad", "apad", args);
AUTO_INSERT_FILTER("-apad", "apad", ost->apad);
}
}
@ -637,12 +617,14 @@ static int configure_output_audio_filter(FilterGraph *fg, OutputFilter *ofilter,
ret = insert_trim(of->start_time, of->recording_time,
&last_filter, &pad_idx, name);
if (ret < 0)
return ret;
goto fail;
if ((ret = avfilter_link(last_filter, pad_idx, ofilter->filter, 0)) < 0)
return ret;
goto fail;
fail:
av_bprint_finalize(&args, NULL);
return 0;
return ret;
}
static int configure_output_filter(FilterGraph *fg, OutputFilter *ofilter,
@ -656,7 +638,7 @@ static int configure_output_filter(FilterGraph *fg, OutputFilter *ofilter,
switch (avfilter_pad_get_type(out->filter_ctx->output_pads, out->pad_idx)) {
case AVMEDIA_TYPE_VIDEO: return configure_output_video_filter(fg, ofilter, out);
case AVMEDIA_TYPE_AUDIO: return configure_output_audio_filter(fg, ofilter, out);
default: av_assert0(0);
default: av_assert0(0); return 0;
}
}
@ -727,6 +709,7 @@ static int configure_input_video_filter(FilterGraph *fg, InputFilter *ifilter,
{
AVFilterContext *last_filter;
const AVFilter *buffer_filt = avfilter_get_by_name("buffer");
const AVPixFmtDescriptor *desc;
InputStream *ist = ifilter->ist;
InputFile *f = input_files[ist->file_index];
AVRational tb = ist->framerate.num ? av_inv_q(ist->framerate) :
@ -784,44 +767,46 @@ static int configure_input_video_filter(FilterGraph *fg, InputFilter *ifilter,
av_freep(&par);
last_filter = ifilter->filter;
if (ist->autorotate) {
double theta = get_rotation(ist->st);
desc = av_pix_fmt_desc_get(ifilter->format);
av_assert0(desc);
// TODO: insert hwaccel enabled filters like transpose_vaapi into the graph
if (ist->autorotate && !(desc->flags & AV_PIX_FMT_FLAG_HWACCEL)) {
int32_t *displaymatrix = ifilter->displaymatrix;
double theta;
if (!displaymatrix)
displaymatrix = (int32_t *)av_stream_get_side_data(ist->st, AV_PKT_DATA_DISPLAYMATRIX, NULL);
theta = get_rotation(displaymatrix);
if (fabs(theta - 90) < 1.0) {
ret = insert_filter(&last_filter, &pad_idx, "transpose", "clock");
ret = insert_filter(&last_filter, &pad_idx, "transpose",
displaymatrix[3] > 0 ? "cclock_flip" : "clock");
} else if (fabs(theta - 180) < 1.0) {
ret = insert_filter(&last_filter, &pad_idx, "hflip", NULL);
if (ret < 0)
return ret;
ret = insert_filter(&last_filter, &pad_idx, "vflip", NULL);
if (displaymatrix[0] < 0) {
ret = insert_filter(&last_filter, &pad_idx, "hflip", NULL);
if (ret < 0)
return ret;
}
if (displaymatrix[4] < 0) {
ret = insert_filter(&last_filter, &pad_idx, "vflip", NULL);
}
} else if (fabs(theta - 270) < 1.0) {
ret = insert_filter(&last_filter, &pad_idx, "transpose", "cclock");
ret = insert_filter(&last_filter, &pad_idx, "transpose",
displaymatrix[3] < 0 ? "clock_flip" : "cclock");
} else if (fabs(theta) > 1.0) {
char rotate_buf[64];
snprintf(rotate_buf, sizeof(rotate_buf), "%f*PI/180", theta);
ret = insert_filter(&last_filter, &pad_idx, "rotate", rotate_buf);
} else if (fabs(theta) < 1.0) {
if (displaymatrix && displaymatrix[4] < 0) {
ret = insert_filter(&last_filter, &pad_idx, "vflip", NULL);
}
}
if (ret < 0)
return ret;
}
if (do_deinterlace) {
AVFilterContext *yadif;
snprintf(name, sizeof(name), "deinterlace_in_%d_%d",
ist->file_index, ist->st->index);
if ((ret = avfilter_graph_create_filter(&yadif,
avfilter_get_by_name("yadif"),
name, "", NULL,
fg->graph)) < 0)
return ret;
if ((ret = avfilter_link(last_filter, 0, yadif, 0)) < 0)
return ret;
last_filter = yadif;
}
snprintf(name, sizeof(name), "trim_in_%d_%d",
ist->file_index, ist->st->index);
if (copy_ts) {
@ -866,11 +851,12 @@ static int configure_input_audio_filter(FilterGraph *fg, InputFilter *ifilter,
1, ifilter->sample_rate,
ifilter->sample_rate,
av_get_sample_fmt_name(ifilter->format));
if (ifilter->channel_layout)
av_bprintf(&args, ":channel_layout=0x%"PRIx64,
ifilter->channel_layout);
else
av_bprintf(&args, ":channels=%d", ifilter->channels);
if (av_channel_layout_check(&ifilter->ch_layout) &&
ifilter->ch_layout.order != AV_CHANNEL_ORDER_UNSPEC) {
av_bprintf(&args, ":channel_layout=");
av_channel_layout_describe_bprint(&ifilter->ch_layout, &args);
} else
av_bprintf(&args, ":channels=%d", ifilter->ch_layout.nb_channels);
snprintf(name, sizeof(name), "graph_%d_in_%d_%d", fg->index,
ist->file_index, ist->st->index);
@ -966,7 +952,7 @@ static int configure_input_filter(FilterGraph *fg, InputFilter *ifilter,
switch (avfilter_pad_get_type(in->filter_ctx->input_pads, in->pad_idx)) {
case AVMEDIA_TYPE_VIDEO: return configure_input_video_filter(fg, ifilter, in);
case AVMEDIA_TYPE_AUDIO: return configure_input_audio_filter(fg, ifilter, in);
default: av_assert0(0);
default: av_assert0(0); return 0;
}
}
@ -980,6 +966,30 @@ static void cleanup_filtergraph(FilterGraph *fg)
avfilter_graph_free(&fg->graph);
}
static int filter_is_buffersrc(const AVFilterContext *f)
{
return f->nb_inputs == 0 &&
(!strcmp(f->filter->name, "buffer") ||
!strcmp(f->filter->name, "abuffer"));
}
static int graph_is_meta(AVFilterGraph *graph)
{
for (unsigned i = 0; i < graph->nb_filters; i++) {
const AVFilterContext *f = graph->filters[i];
/* in addition to filters flagged as meta, also
* disregard sinks and buffersources (but not other sources,
* since they introduce data we are not aware of)
*/
if (!((f->filter->flags & AVFILTER_FLAG_METADATA_ONLY) ||
f->nb_outputs == 0 ||
filter_is_buffersrc(f)))
return 0;
}
return 1;
}
int configure_filtergraph(FilterGraph *fg)
{
AVFilterInOut *inputs, *outputs, *cur;
@ -994,20 +1004,31 @@ int configure_filtergraph(FilterGraph *fg)
if (simple) {
OutputStream *ost = fg->outputs[0]->ost;
char args[512];
AVDictionaryEntry *e = NULL;
const AVDictionaryEntry *e = NULL;
fg->graph->nb_threads = filter_nbthreads;
if (filter_nbthreads) {
ret = av_opt_set(fg->graph, "threads", filter_nbthreads, 0);
if (ret < 0)
goto fail;
} else {
e = av_dict_get(ost->encoder_opts, "threads", NULL, 0);
if (e)
av_opt_set(fg->graph, "threads", e->value, 0);
}
args[0] = 0;
e = NULL;
while ((e = av_dict_get(ost->sws_dict, "", e,
AV_DICT_IGNORE_SUFFIX))) {
av_strlcatf(args, sizeof(args), "%s=%s:", e->key, e->value);
}
if (strlen(args))
if (strlen(args)) {
args[strlen(args)-1] = 0;
fg->graph->scale_sws_opts = av_strdup(args);
fg->graph->scale_sws_opts = av_strdup(args);
}
args[0] = 0;
e = NULL;
while ((e = av_dict_get(ost->swr_opts, "", e,
AV_DICT_IGNORE_SUFFIX))) {
av_strlcatf(args, sizeof(args), "%s=%s:", e->key, e->value);
@ -1015,18 +1036,6 @@ int configure_filtergraph(FilterGraph *fg)
if (strlen(args))
args[strlen(args)-1] = 0;
av_opt_set(fg->graph, "aresample_swr_opts", args, 0);
args[0] = '\0';
while ((e = av_dict_get(fg->outputs[0]->ost->resample_opts, "", e,
AV_DICT_IGNORE_SUFFIX))) {
av_strlcatf(args, sizeof(args), "%s=%s:", e->key, e->value);
}
if (strlen(args))
args[strlen(args) - 1] = '\0';
e = av_dict_get(ost->encoder_opts, "threads", NULL, 0);
if (e)
av_opt_set(fg->graph, "threads", e->value, 0);
} else {
fg->graph->nb_threads = filter_complex_nbthreads;
}
@ -1081,6 +1090,8 @@ int configure_filtergraph(FilterGraph *fg)
if ((ret = avfilter_graph_config(fg->graph, NULL)) < 0)
goto fail;
fg->is_meta = graph_is_meta(fg->graph);
/* limit the lists of allowed formats to the ones selected, to
* make sure they stay the same if the filtergraph is reconfigured later */
for (i = 0; i < fg->nb_outputs; i++) {
@ -1093,7 +1104,10 @@ int configure_filtergraph(FilterGraph *fg)
ofilter->height = av_buffersink_get_h(sink);
ofilter->sample_rate = av_buffersink_get_sample_rate(sink);
ofilter->channel_layout = av_buffersink_get_channel_layout(sink);
av_channel_layout_uninit(&ofilter->ch_layout);
ret = av_buffersink_get_ch_layout(sink, &ofilter->ch_layout);
if (ret < 0)
goto fail;
}
fg->reconfiguration = 1;
@ -1115,9 +1129,8 @@ int configure_filtergraph(FilterGraph *fg)
}
for (i = 0; i < fg->nb_inputs; i++) {
while (av_fifo_size(fg->inputs[i]->frame_queue)) {
AVFrame *tmp;
av_fifo_generic_read(fg->inputs[i]->frame_queue, &tmp, sizeof(tmp), NULL);
AVFrame *tmp;
while (av_fifo_read(fg->inputs[i]->frame_queue, &tmp, 1) >= 0) {
ret = av_buffersrc_add_frame(fg->inputs[i]->filter, tmp);
av_frame_free(&tmp);
if (ret < 0)
@ -1138,9 +1151,8 @@ int configure_filtergraph(FilterGraph *fg)
for (i = 0; i < fg->nb_inputs; i++) {
InputStream *ist = fg->inputs[i]->ist;
if (ist->sub2video.sub_queue && ist->sub2video.frame) {
while (av_fifo_size(ist->sub2video.sub_queue)) {
AVSubtitle tmp;
av_fifo_generic_read(ist->sub2video.sub_queue, &tmp, sizeof(tmp), NULL);
AVSubtitle tmp;
while (av_fifo_read(ist->sub2video.sub_queue, &tmp, 1) >= 0) {
sub2video_update(ist, INT64_MIN, &tmp);
avsubtitle_free(&tmp);
}
@ -1156,6 +1168,9 @@ fail:
int ifilter_parameters_from_frame(InputFilter *ifilter, const AVFrame *frame)
{
AVFrameSideData *sd;
int ret;
av_buffer_unref(&ifilter->hw_frames_ctx);
ifilter->format = frame->format;
@ -1165,8 +1180,14 @@ int ifilter_parameters_from_frame(InputFilter *ifilter, const AVFrame *frame)
ifilter->sample_aspect_ratio = frame->sample_aspect_ratio;
ifilter->sample_rate = frame->sample_rate;
ifilter->channels = frame->channels;
ifilter->channel_layout = frame->channel_layout;
ret = av_channel_layout_copy(&ifilter->ch_layout, &frame->ch_layout);
if (ret < 0)
return ret;
av_freep(&ifilter->displaymatrix);
sd = av_frame_get_side_data(frame, AV_FRAME_DATA_DISPLAYMATRIX);
if (sd)
ifilter->displaymatrix = av_memdup(sd->data, sizeof(int32_t) * 9);
if (frame->hw_frames_ctx) {
ifilter->hw_frames_ctx = av_buffer_ref(frame->hw_frames_ctx);

View File

@ -93,6 +93,8 @@ static char *hw_device_default_name(enum AVHWDeviceType type)
int hw_device_init_from_string(const char *arg, HWDevice **dev_out)
{
// "type=name"
// "type=name,key=value,key2=value2"
// "type=name:device,key=value,key2=value2"
// "type:device,key=value,key2=value2"
// -> av_hwdevice_ctx_create()
@ -124,7 +126,7 @@ int hw_device_init_from_string(const char *arg, HWDevice **dev_out)
}
if (*p == '=') {
k = strcspn(p + 1, ":@");
k = strcspn(p + 1, ":@,");
name = av_strndup(p + 1, k);
if (!name) {
@ -190,6 +192,18 @@ int hw_device_init_from_string(const char *arg, HWDevice **dev_out)
src->device_ref, 0);
if (err < 0)
goto fail;
} else if (*p == ',') {
err = av_dict_parse_string(&options, p + 1, "=", ",", 0);
if (err < 0) {
errmsg = "failed to parse options";
goto invalid;
}
err = av_hwdevice_ctx_create(&device_ref, type,
NULL, options, 0);
if (err < 0)
goto fail;
} else {
errmsg = "parse error";
goto invalid;
@ -339,6 +353,18 @@ int hw_device_setup_for_decode(InputStream *ist)
} else if (ist->hwaccel_id == HWACCEL_GENERIC) {
type = ist->hwaccel_device_type;
dev = hw_device_get_by_type(type);
// When "-qsv_device device" is used, an internal QSV device named
// as "__qsv_device" is created. Another QSV device is created too
// if "-init_hw_device qsv=name:device" is used. There are 2 QSV devices
// if both "-qsv_device device" and "-init_hw_device qsv=name:device"
// are used, hw_device_get_by_type(AV_HWDEVICE_TYPE_QSV) returns NULL.
// To keep back-compatibility with the removed ad-hoc libmfx setup code,
// call hw_device_get_by_name("__qsv_device") to select the internal QSV
// device.
if (!dev && type == AV_HWDEVICE_TYPE_QSV)
dev = hw_device_get_by_name("__qsv_device");
if (!dev)
err = hw_device_init_from_type(type, NULL, &dev);
} else {
@ -527,15 +553,21 @@ int hw_device_setup_for_filter(FilterGraph *fg)
HWDevice *dev;
int i;
// If the user has supplied exactly one hardware device then just
// give it straight to every filter for convenience. If more than
// one device is available then the user needs to pick one explcitly
// with the filter_hw_device option.
// Pick the last hardware device if the user doesn't pick the device for
// filters explicitly with the filter_hw_device option.
if (filter_hw_device)
dev = filter_hw_device;
else if (nb_hw_devices == 1)
dev = hw_devices[0];
else
else if (nb_hw_devices > 0) {
dev = hw_devices[nb_hw_devices - 1];
if (nb_hw_devices > 1)
av_log(NULL, AV_LOG_WARNING, "There are %d hardware devices. device "
"%s of type %s is picked for filters by default. Set hardware "
"device explicitly with the filter_hw_device option if device "
"%s is not usable for filters.\n",
nb_hw_devices, dev->name,
av_hwdevice_get_type_name(dev->type), dev->name);
} else
dev = NULL;
if (dev) {

317
fftools/ffmpeg_mux.c Normal file
View File

@ -0,0 +1,317 @@
/*
* 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
*/
#include <stdio.h>
#include <string.h>
#include "ffmpeg.h"
#include "libavutil/fifo.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/log.h"
#include "libavutil/mem.h"
#include "libavutil/timestamp.h"
#include "libavcodec/packet.h"
#include "libavformat/avformat.h"
#include "libavformat/avio.h"
static void close_all_output_streams(OutputStream *ost, OSTFinished this_stream, OSTFinished others)
{
int i;
for (i = 0; i < nb_output_streams; i++) {
OutputStream *ost2 = output_streams[i];
ost2->finished |= ost == ost2 ? this_stream : others;
}
}
void of_write_packet(OutputFile *of, AVPacket *pkt, OutputStream *ost,
int unqueue)
{
AVFormatContext *s = of->ctx;
AVStream *st = ost->st;
int ret;
/*
* Audio encoders may split the packets -- #frames in != #packets out.
* But there is no reordering, so we can limit the number of output packets
* by simply dropping them here.
* Counting encoded video frames needs to be done separately because of
* reordering, see do_video_out().
* Do not count the packet when unqueued because it has been counted when queued.
*/
if (!(st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO && ost->encoding_needed) && !unqueue) {
if (ost->frame_number >= ost->max_frames) {
av_packet_unref(pkt);
return;
}
ost->frame_number++;
}
if (!of->header_written) {
AVPacket *tmp_pkt;
/* the muxer is not initialized yet, buffer the packet */
if (!av_fifo_can_write(ost->muxing_queue)) {
size_t cur_size = av_fifo_can_read(ost->muxing_queue);
unsigned int are_we_over_size =
(ost->muxing_queue_data_size + pkt->size) > ost->muxing_queue_data_threshold;
size_t limit = are_we_over_size ? ost->max_muxing_queue_size : SIZE_MAX;
size_t new_size = FFMIN(2 * cur_size, limit);
if (new_size <= cur_size) {
av_log(NULL, AV_LOG_ERROR,
"Too many packets buffered for output stream %d:%d.\n",
ost->file_index, ost->st->index);
exit_program(1);
}
ret = av_fifo_grow2(ost->muxing_queue, new_size - cur_size);
if (ret < 0)
exit_program(1);
}
ret = av_packet_make_refcounted(pkt);
if (ret < 0)
exit_program(1);
tmp_pkt = av_packet_alloc();
if (!tmp_pkt)
exit_program(1);
av_packet_move_ref(tmp_pkt, pkt);
ost->muxing_queue_data_size += tmp_pkt->size;
av_fifo_write(ost->muxing_queue, &tmp_pkt, 1);
return;
}
if ((st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO && ost->vsync_method == VSYNC_DROP) ||
(st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO && audio_sync_method < 0))
pkt->pts = pkt->dts = AV_NOPTS_VALUE;
if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) {
if (ost->frame_rate.num && ost->is_cfr) {
if (pkt->duration > 0)
av_log(NULL, AV_LOG_WARNING, "Overriding packet duration by frame rate, this should not happen\n");
pkt->duration = av_rescale_q(1, av_inv_q(ost->frame_rate),
ost->mux_timebase);
}
}
av_packet_rescale_ts(pkt, ost->mux_timebase, ost->st->time_base);
if (!(s->oformat->flags & AVFMT_NOTIMESTAMPS)) {
if (pkt->dts != AV_NOPTS_VALUE &&
pkt->pts != AV_NOPTS_VALUE &&
pkt->dts > pkt->pts) {
av_log(s, AV_LOG_WARNING, "Invalid DTS: %"PRId64" PTS: %"PRId64" in output stream %d:%d, replacing by guess\n",
pkt->dts, pkt->pts,
ost->file_index, ost->st->index);
pkt->pts =
pkt->dts = pkt->pts + pkt->dts + ost->last_mux_dts + 1
- FFMIN3(pkt->pts, pkt->dts, ost->last_mux_dts + 1)
- FFMAX3(pkt->pts, pkt->dts, ost->last_mux_dts + 1);
}
if ((st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO || st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO || st->codecpar->codec_type == AVMEDIA_TYPE_SUBTITLE) &&
pkt->dts != AV_NOPTS_VALUE &&
ost->last_mux_dts != AV_NOPTS_VALUE) {
int64_t max = ost->last_mux_dts + !(s->oformat->flags & AVFMT_TS_NONSTRICT);
if (pkt->dts < max) {
int loglevel = max - pkt->dts > 2 || st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO ? AV_LOG_WARNING : AV_LOG_DEBUG;
if (exit_on_error)
loglevel = AV_LOG_ERROR;
av_log(s, loglevel, "Non-monotonous DTS in output stream "
"%d:%d; previous: %"PRId64", current: %"PRId64"; ",
ost->file_index, ost->st->index, ost->last_mux_dts, pkt->dts);
if (exit_on_error) {
av_log(NULL, AV_LOG_FATAL, "aborting.\n");
exit_program(1);
}
av_log(s, loglevel, "changing to %"PRId64". This may result "
"in incorrect timestamps in the output file.\n",
max);
if (pkt->pts >= pkt->dts)
pkt->pts = FFMAX(pkt->pts, max);
pkt->dts = max;
}
}
}
ost->last_mux_dts = pkt->dts;
ost->data_size += pkt->size;
ost->packets_written++;
pkt->stream_index = ost->index;
if (debug_ts) {
av_log(NULL, AV_LOG_INFO, "muxer <- type:%s "
"pkt_pts:%s pkt_pts_time:%s pkt_dts:%s pkt_dts_time:%s duration:%s duration_time:%s size:%d\n",
av_get_media_type_string(ost->enc_ctx->codec_type),
av_ts2str(pkt->pts), av_ts2timestr(pkt->pts, &ost->st->time_base),
av_ts2str(pkt->dts), av_ts2timestr(pkt->dts, &ost->st->time_base),
av_ts2str(pkt->duration), av_ts2timestr(pkt->duration, &ost->st->time_base),
pkt->size
);
}
ret = av_interleaved_write_frame(s, pkt);
if (ret < 0) {
print_error("av_interleaved_write_frame()", ret);
main_return_code = 1;
close_all_output_streams(ost, MUXER_FINISHED | ENCODER_FINISHED, ENCODER_FINISHED);
}
}
static int print_sdp(void)
{
char sdp[16384];
int i;
int j, ret;
AVIOContext *sdp_pb;
AVFormatContext **avc;
for (i = 0; i < nb_output_files; i++) {
if (!output_files[i]->header_written)
return 0;
}
avc = av_malloc_array(nb_output_files, sizeof(*avc));
if (!avc)
exit_program(1);
for (i = 0, j = 0; i < nb_output_files; i++) {
if (!strcmp(output_files[i]->ctx->oformat->name, "rtp")) {
avc[j] = output_files[i]->ctx;
j++;
}
}
if (!j) {
av_log(NULL, AV_LOG_ERROR, "No output streams in the SDP.\n");
ret = AVERROR(EINVAL);
goto fail;
}
ret = av_sdp_create(avc, j, sdp, sizeof(sdp));
if (ret < 0)
goto fail;
if (!sdp_filename) {
printf("SDP:\n%s\n", sdp);
fflush(stdout);
} else {
ret = avio_open2(&sdp_pb, sdp_filename, AVIO_FLAG_WRITE, &int_cb, NULL);
if (ret < 0) {
av_log(NULL, AV_LOG_ERROR, "Failed to open sdp file '%s'\n", sdp_filename);
goto fail;
}
avio_print(sdp_pb, sdp);
avio_closep(&sdp_pb);
av_freep(&sdp_filename);
}
fail:
av_freep(&avc);
return ret;
}
/* open the muxer when all the streams are initialized */
int of_check_init(OutputFile *of)
{
int ret, i;
for (i = 0; i < of->ctx->nb_streams; i++) {
OutputStream *ost = output_streams[of->ost_index + i];
if (!ost->initialized)
return 0;
}
ret = avformat_write_header(of->ctx, &of->opts);
if (ret < 0) {
av_log(NULL, AV_LOG_ERROR,
"Could not write header for output file #%d "
"(incorrect codec parameters ?): %s\n",
of->index, av_err2str(ret));
return ret;
}
//assert_avoptions(of->opts);
of->header_written = 1;
av_dump_format(of->ctx, of->index, of->ctx->url, 1);
nb_output_dumped++;
if (sdp_filename || want_sdp) {
ret = print_sdp();
if (ret < 0) {
av_log(NULL, AV_LOG_ERROR, "Error writing the SDP.\n");
return ret;
}
}
/* flush the muxing queues */
for (i = 0; i < of->ctx->nb_streams; i++) {
OutputStream *ost = output_streams[of->ost_index + i];
AVPacket *pkt;
/* try to improve muxing time_base (only possible if nothing has been written yet) */
if (!av_fifo_can_read(ost->muxing_queue))
ost->mux_timebase = ost->st->time_base;
while (av_fifo_read(ost->muxing_queue, &pkt, 1) >= 0) {
ost->muxing_queue_data_size -= pkt->size;
of_write_packet(of, pkt, ost, 1);
av_packet_free(&pkt);
}
}
return 0;
}
int of_write_trailer(OutputFile *of)
{
int ret;
if (!of->header_written) {
av_log(NULL, AV_LOG_ERROR,
"Nothing was written into output file %d (%s), because "
"at least one of its streams received no packets.\n",
of->index, of->ctx->url);
return AVERROR(EINVAL);
}
ret = av_write_trailer(of->ctx);
if (ret < 0) {
av_log(NULL, AV_LOG_ERROR, "Error writing trailer of %s: %s\n", of->ctx->url, av_err2str(ret));
return ret;
}
return 0;
}
void of_close(OutputFile **pof)
{
OutputFile *of = *pof;
AVFormatContext *s;
if (!of)
return;
s = of->ctx;
if (s && s->oformat && !(s->oformat->flags & AVFMT_NOFILE))
avio_closep(&s->pb);
avformat_free_context(s);
av_dict_free(&of->opts);
av_freep(pof);
}

File diff suppressed because it is too large Load Diff

View File

@ -24,6 +24,7 @@
*/
#include "config.h"
#include "config_components.h"
#include <inttypes.h>
#include <math.h>
#include <limits.h>
@ -31,6 +32,7 @@
#include <stdint.h>
#include "libavutil/avstring.h"
#include "libavutil/channel_layout.h"
#include "libavutil/eval.h"
#include "libavutil/mathematics.h"
#include "libavutil/pixdesc.h"
@ -39,7 +41,6 @@
#include "libavutil/fifo.h"
#include "libavutil/parseutils.h"
#include "libavutil/samplefmt.h"
#include "libavutil/avassert.h"
#include "libavutil/time.h"
#include "libavutil/bprint.h"
#include "libavformat/avformat.h"
@ -59,8 +60,7 @@
#include <SDL_thread.h>
#include "cmdutils.h"
#include <assert.h>
#include "opt_common.h"
const char program_name[] = "ffplay";
const int program_birth_year = 2003;
@ -117,7 +117,7 @@ typedef struct MyAVPacketList {
} MyAVPacketList;
typedef struct PacketQueue {
AVFifoBuffer *pkt_list;
AVFifo *pkt_list;
int nb_packets;
int size;
int64_t duration;
@ -134,8 +134,7 @@ typedef struct PacketQueue {
typedef struct AudioParams {
int freq;
int channels;
int64_t channel_layout;
AVChannelLayout ch_layout;
enum AVSampleFormat fmt;
int frame_size;
int bytes_per_sec;
@ -203,7 +202,7 @@ typedef struct Decoder {
typedef struct VideoState {
SDL_Thread *read_tid;
AVInputFormat *iformat;
const AVInputFormat *iformat;
int abort_request;
int force_refresh;
int paused;
@ -308,7 +307,7 @@ typedef struct VideoState {
} VideoState;
/* options specified by the user */
static AVInputFormat *file_iformat;
static const AVInputFormat *file_iformat;
static const char *input_filename;
static const char *window_title;
static int default_width = 640;
@ -414,31 +413,21 @@ int cmp_audio_fmts(enum AVSampleFormat fmt1, int64_t channel_count1,
return channel_count1 != channel_count2 || fmt1 != fmt2;
}
static inline
int64_t get_valid_channel_layout(int64_t channel_layout, int channels)
{
if (channel_layout && av_get_channel_layout_nb_channels(channel_layout) == channels)
return channel_layout;
else
return 0;
}
static int packet_queue_put_private(PacketQueue *q, AVPacket *pkt)
{
MyAVPacketList pkt1;
int ret;
if (q->abort_request)
return -1;
if (av_fifo_space(q->pkt_list) < sizeof(pkt1)) {
if (av_fifo_grow(q->pkt_list, sizeof(pkt1)) < 0)
return -1;
}
pkt1.pkt = pkt;
pkt1.serial = q->serial;
av_fifo_generic_write(q->pkt_list, &pkt1, sizeof(pkt1), NULL);
ret = av_fifo_write(q->pkt_list, &pkt1, 1);
if (ret < 0)
return ret;
q->nb_packets++;
q->size += pkt1.pkt->size + sizeof(pkt1);
q->duration += pkt1.pkt->duration;
@ -479,7 +468,7 @@ static int packet_queue_put_nullpacket(PacketQueue *q, AVPacket *pkt, int stream
static int packet_queue_init(PacketQueue *q)
{
memset(q, 0, sizeof(PacketQueue));
q->pkt_list = av_fifo_alloc(sizeof(MyAVPacketList));
q->pkt_list = av_fifo_alloc2(1, sizeof(MyAVPacketList), AV_FIFO_FLAG_AUTO_GROW);
if (!q->pkt_list)
return AVERROR(ENOMEM);
q->mutex = SDL_CreateMutex();
@ -501,10 +490,8 @@ static void packet_queue_flush(PacketQueue *q)
MyAVPacketList pkt1;
SDL_LockMutex(q->mutex);
while (av_fifo_size(q->pkt_list) >= sizeof(pkt1)) {
av_fifo_generic_read(q->pkt_list, &pkt1, sizeof(pkt1), NULL);
while (av_fifo_read(q->pkt_list, &pkt1, 1) >= 0)
av_packet_free(&pkt1.pkt);
}
q->nb_packets = 0;
q->size = 0;
q->duration = 0;
@ -515,7 +502,7 @@ static void packet_queue_flush(PacketQueue *q)
static void packet_queue_destroy(PacketQueue *q)
{
packet_queue_flush(q);
av_fifo_freep(&q->pkt_list);
av_fifo_freep2(&q->pkt_list);
SDL_DestroyMutex(q->mutex);
SDL_DestroyCond(q->cond);
}
@ -553,8 +540,7 @@ static int packet_queue_get(PacketQueue *q, AVPacket *pkt, int block, int *seria
break;
}
if (av_fifo_size(q->pkt_list) >= sizeof(pkt1)) {
av_fifo_generic_read(q->pkt_list, &pkt1, sizeof(pkt1), NULL);
if (av_fifo_read(q->pkt_list, &pkt1, 1) >= 0) {
q->nb_packets--;
q->size -= pkt1.pkt->size + sizeof(pkt1);
q->duration -= pkt1.pkt->duration;
@ -965,10 +951,10 @@ static void set_sdl_yuv_conversion_mode(AVFrame *frame)
mode = SDL_YUV_CONVERSION_JPEG;
else if (frame->colorspace == AVCOL_SPC_BT709)
mode = SDL_YUV_CONVERSION_BT709;
else if (frame->colorspace == AVCOL_SPC_BT470BG || frame->colorspace == AVCOL_SPC_SMPTE170M || frame->colorspace == AVCOL_SPC_SMPTE240M)
else if (frame->colorspace == AVCOL_SPC_BT470BG || frame->colorspace == AVCOL_SPC_SMPTE170M)
mode = SDL_YUV_CONVERSION_BT601;
}
SDL_SetYUVConversionMode(mode);
SDL_SetYUVConversionMode(mode); /* FIXME: no support for linear transfer */
#endif
}
@ -1025,15 +1011,17 @@ static void video_image_display(VideoState *is)
}
calculate_display_rect(&rect, is->xleft, is->ytop, is->width, is->height, vp->width, vp->height, vp->sar);
set_sdl_yuv_conversion_mode(vp->frame);
if (!vp->uploaded) {
if (upload_texture(&is->vid_texture, vp->frame, &is->img_convert_ctx) < 0)
if (upload_texture(&is->vid_texture, vp->frame, &is->img_convert_ctx) < 0) {
set_sdl_yuv_conversion_mode(NULL);
return;
}
vp->uploaded = 1;
vp->flip_v = vp->frame->linesize[0] < 0;
}
set_sdl_yuv_conversion_mode(vp->frame);
SDL_RenderCopyEx(renderer, is->vid_texture, NULL, &rect, 0, NULL, vp->flip_v ? SDL_FLIP_VERTICAL : 0);
set_sdl_yuv_conversion_mode(NULL);
if (sp) {
@ -1072,7 +1060,7 @@ static void video_audio_display(VideoState *s)
nb_freq = 1 << (rdft_bits - 1);
/* compute display index : center on currently output samples */
channels = s->audio_tgt.channels;
channels = s->audio_tgt.ch_layout.nb_channels;
nb_display_channels = channels;
if (!s->paused) {
int data_used= s->show_mode == SHOW_MODE_WAVES ? s->width : (2*nb_freq);
@ -1470,13 +1458,13 @@ static void check_external_clock_speed(VideoState *is) {
}
/* seek in the stream */
static void stream_seek(VideoState *is, int64_t pos, int64_t rel, int seek_by_bytes)
static void stream_seek(VideoState *is, int64_t pos, int64_t rel, int by_bytes)
{
if (!is->seek_req) {
is->seek_pos = pos;
is->seek_rel = rel;
is->seek_flags &= ~AVSEEK_FLAG_BYTE;
if (seek_by_bytes)
if (by_bytes)
is->seek_flags |= AVSEEK_FLAG_BYTE;
is->seek_req = 1;
SDL_CondSignal(is->continue_read_thread);
@ -1858,7 +1846,7 @@ static int configure_video_filters(AVFilterGraph *graph, VideoState *is, const c
AVFilterContext *filt_src = NULL, *filt_out = NULL, *last_filter = NULL;
AVCodecParameters *codecpar = is->video_st->codecpar;
AVRational fr = av_guess_frame_rate(is->ic, is->video_st, NULL);
AVDictionaryEntry *e = NULL;
const AVDictionaryEntry *e = NULL;
int nb_pix_fmts = 0;
int i, j;
@ -1927,7 +1915,8 @@ static int configure_video_filters(AVFilterGraph *graph, VideoState *is, const c
} while (0)
if (autorotate) {
double theta = get_rotation(is->video_st);
int32_t *displaymatrix = (int32_t *)av_stream_get_side_data(is->video_st, AV_PKT_DATA_DISPLAYMATRIX, NULL);
double theta = get_rotation(displaymatrix);
if (fabs(theta - 90) < 1.0) {
INSERT_FILT("transpose", "clock");
@ -1957,11 +1946,10 @@ static int configure_audio_filters(VideoState *is, const char *afilters, int for
{
static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_NONE };
int sample_rates[2] = { 0, -1 };
int64_t channel_layouts[2] = { 0, -1 };
int channels[2] = { 0, -1 };
AVFilterContext *filt_asrc = NULL, *filt_asink = NULL;
char aresample_swr_opts[512] = "";
AVDictionaryEntry *e = NULL;
const AVDictionaryEntry *e = NULL;
AVBPrint bp;
char asrc_args[256];
int ret;
@ -1970,20 +1958,20 @@ static int configure_audio_filters(VideoState *is, const char *afilters, int for
return AVERROR(ENOMEM);
is->agraph->nb_threads = filter_nbthreads;
av_bprint_init(&bp, 0, AV_BPRINT_SIZE_AUTOMATIC);
while ((e = av_dict_get(swr_opts, "", e, AV_DICT_IGNORE_SUFFIX)))
av_strlcatf(aresample_swr_opts, sizeof(aresample_swr_opts), "%s=%s:", e->key, e->value);
if (strlen(aresample_swr_opts))
aresample_swr_opts[strlen(aresample_swr_opts)-1] = '\0';
av_opt_set(is->agraph, "aresample_swr_opts", aresample_swr_opts, 0);
av_channel_layout_describe_bprint(&is->audio_filter_src.ch_layout, &bp);
ret = snprintf(asrc_args, sizeof(asrc_args),
"sample_rate=%d:sample_fmt=%s:channels=%d:time_base=%d/%d",
"sample_rate=%d:sample_fmt=%s:time_base=%d/%d:channel_layout=%s",
is->audio_filter_src.freq, av_get_sample_fmt_name(is->audio_filter_src.fmt),
is->audio_filter_src.channels,
1, is->audio_filter_src.freq);
if (is->audio_filter_src.channel_layout)
snprintf(asrc_args + ret, sizeof(asrc_args) - ret,
":channel_layout=0x%"PRIx64, is->audio_filter_src.channel_layout);
1, is->audio_filter_src.freq, bp.str);
ret = avfilter_graph_create_filter(&filt_asrc,
avfilter_get_by_name("abuffer"), "ffplay_abuffer",
@ -2004,14 +1992,10 @@ static int configure_audio_filters(VideoState *is, const char *afilters, int for
goto end;
if (force_output_format) {
channel_layouts[0] = is->audio_tgt.channel_layout;
channels [0] = is->audio_tgt.channel_layout ? -1 : is->audio_tgt.channels;
sample_rates [0] = is->audio_tgt.freq;
if ((ret = av_opt_set_int(filt_asink, "all_channel_counts", 0, AV_OPT_SEARCH_CHILDREN)) < 0)
goto end;
if ((ret = av_opt_set_int_list(filt_asink, "channel_layouts", channel_layouts, -1, AV_OPT_SEARCH_CHILDREN)) < 0)
goto end;
if ((ret = av_opt_set_int_list(filt_asink, "channel_counts" , channels , -1, AV_OPT_SEARCH_CHILDREN)) < 0)
if ((ret = av_opt_set(filt_asink, "ch_layouts", bp.str, AV_OPT_SEARCH_CHILDREN)) < 0)
goto end;
if ((ret = av_opt_set_int_list(filt_asink, "sample_rates" , sample_rates , -1, AV_OPT_SEARCH_CHILDREN)) < 0)
goto end;
@ -2027,6 +2011,8 @@ static int configure_audio_filters(VideoState *is, const char *afilters, int for
end:
if (ret < 0)
avfilter_graph_free(&is->agraph);
av_bprint_finalize(&bp, NULL);
return ret;
}
#endif /* CONFIG_AVFILTER */
@ -2038,7 +2024,6 @@ static int audio_thread(void *arg)
Frame *af;
#if CONFIG_AVFILTER
int last_serial = -1;
int64_t dec_channel_layout;
int reconfigure;
#endif
int got_frame = 0;
@ -2056,27 +2041,26 @@ static int audio_thread(void *arg)
tb = (AVRational){1, frame->sample_rate};
#if CONFIG_AVFILTER
dec_channel_layout = get_valid_channel_layout(frame->channel_layout, frame->channels);
reconfigure =
cmp_audio_fmts(is->audio_filter_src.fmt, is->audio_filter_src.channels,
frame->format, frame->channels) ||
is->audio_filter_src.channel_layout != dec_channel_layout ||
cmp_audio_fmts(is->audio_filter_src.fmt, is->audio_filter_src.ch_layout.nb_channels,
frame->format, frame->ch_layout.nb_channels) ||
av_channel_layout_compare(&is->audio_filter_src.ch_layout, &frame->ch_layout) ||
is->audio_filter_src.freq != frame->sample_rate ||
is->auddec.pkt_serial != last_serial;
if (reconfigure) {
char buf1[1024], buf2[1024];
av_get_channel_layout_string(buf1, sizeof(buf1), -1, is->audio_filter_src.channel_layout);
av_get_channel_layout_string(buf2, sizeof(buf2), -1, dec_channel_layout);
av_channel_layout_describe(&is->audio_filter_src.ch_layout, buf1, sizeof(buf1));
av_channel_layout_describe(&frame->ch_layout, buf2, sizeof(buf2));
av_log(NULL, AV_LOG_DEBUG,
"Audio frame changed from rate:%d ch:%d fmt:%s layout:%s serial:%d to rate:%d ch:%d fmt:%s layout:%s serial:%d\n",
is->audio_filter_src.freq, is->audio_filter_src.channels, av_get_sample_fmt_name(is->audio_filter_src.fmt), buf1, last_serial,
frame->sample_rate, frame->channels, av_get_sample_fmt_name(frame->format), buf2, is->auddec.pkt_serial);
is->audio_filter_src.freq, is->audio_filter_src.ch_layout.nb_channels, av_get_sample_fmt_name(is->audio_filter_src.fmt), buf1, last_serial,
frame->sample_rate, frame->ch_layout.nb_channels, av_get_sample_fmt_name(frame->format), buf2, is->auddec.pkt_serial);
is->audio_filter_src.fmt = frame->format;
is->audio_filter_src.channels = frame->channels;
is->audio_filter_src.channel_layout = dec_channel_layout;
ret = av_channel_layout_copy(&is->audio_filter_src.ch_layout, &frame->ch_layout);
if (ret < 0)
goto the_end;
is->audio_filter_src.freq = frame->sample_rate;
last_serial = is->auddec.pkt_serial;
@ -2342,7 +2326,6 @@ static int synchronize_audio(VideoState *is, int nb_samples)
static int audio_decode_frame(VideoState *is)
{
int data_size, resampled_data_size;
int64_t dec_channel_layout;
av_unused double audio_clock0;
int wanted_nb_samples;
Frame *af;
@ -2363,34 +2346,31 @@ static int audio_decode_frame(VideoState *is)
frame_queue_next(&is->sampq);
} while (af->serial != is->audioq.serial);
data_size = av_samples_get_buffer_size(NULL, af->frame->channels,
data_size = av_samples_get_buffer_size(NULL, af->frame->ch_layout.nb_channels,
af->frame->nb_samples,
af->frame->format, 1);
dec_channel_layout =
(af->frame->channel_layout && af->frame->channels == av_get_channel_layout_nb_channels(af->frame->channel_layout)) ?
af->frame->channel_layout : av_get_default_channel_layout(af->frame->channels);
wanted_nb_samples = synchronize_audio(is, af->frame->nb_samples);
if (af->frame->format != is->audio_src.fmt ||
dec_channel_layout != is->audio_src.channel_layout ||
av_channel_layout_compare(&af->frame->ch_layout, &is->audio_src.ch_layout) ||
af->frame->sample_rate != is->audio_src.freq ||
(wanted_nb_samples != af->frame->nb_samples && !is->swr_ctx)) {
swr_free(&is->swr_ctx);
is->swr_ctx = swr_alloc_set_opts(NULL,
is->audio_tgt.channel_layout, is->audio_tgt.fmt, is->audio_tgt.freq,
dec_channel_layout, af->frame->format, af->frame->sample_rate,
0, NULL);
swr_alloc_set_opts2(&is->swr_ctx,
&is->audio_tgt.ch_layout, is->audio_tgt.fmt, is->audio_tgt.freq,
&af->frame->ch_layout, af->frame->format, af->frame->sample_rate,
0, NULL);
if (!is->swr_ctx || swr_init(is->swr_ctx) < 0) {
av_log(NULL, AV_LOG_ERROR,
"Cannot create sample rate converter for conversion of %d Hz %s %d channels to %d Hz %s %d channels!\n",
af->frame->sample_rate, av_get_sample_fmt_name(af->frame->format), af->frame->channels,
is->audio_tgt.freq, av_get_sample_fmt_name(is->audio_tgt.fmt), is->audio_tgt.channels);
af->frame->sample_rate, av_get_sample_fmt_name(af->frame->format), af->frame->ch_layout.nb_channels,
is->audio_tgt.freq, av_get_sample_fmt_name(is->audio_tgt.fmt), is->audio_tgt.ch_layout.nb_channels);
swr_free(&is->swr_ctx);
return -1;
}
is->audio_src.channel_layout = dec_channel_layout;
is->audio_src.channels = af->frame->channels;
if (av_channel_layout_copy(&is->audio_src.ch_layout, &af->frame->ch_layout) < 0)
return -1;
is->audio_src.freq = af->frame->sample_rate;
is->audio_src.fmt = af->frame->format;
}
@ -2399,7 +2379,7 @@ static int audio_decode_frame(VideoState *is)
const uint8_t **in = (const uint8_t **)af->frame->extended_data;
uint8_t **out = &is->audio_buf1;
int out_count = (int64_t)wanted_nb_samples * is->audio_tgt.freq / af->frame->sample_rate + 256;
int out_size = av_samples_get_buffer_size(NULL, is->audio_tgt.channels, out_count, is->audio_tgt.fmt, 0);
int out_size = av_samples_get_buffer_size(NULL, is->audio_tgt.ch_layout.nb_channels, out_count, is->audio_tgt.fmt, 0);
int len2;
if (out_size < 0) {
av_log(NULL, AV_LOG_ERROR, "av_samples_get_buffer_size() failed\n");
@ -2426,7 +2406,7 @@ static int audio_decode_frame(VideoState *is)
swr_free(&is->swr_ctx);
}
is->audio_buf = is->audio_buf1;
resampled_data_size = len2 * is->audio_tgt.channels * av_get_bytes_per_sample(is->audio_tgt.fmt);
resampled_data_size = len2 * is->audio_tgt.ch_layout.nb_channels * av_get_bytes_per_sample(is->audio_tgt.fmt);
} else {
is->audio_buf = af->frame->data[0];
resampled_data_size = data_size;
@ -2495,24 +2475,26 @@ static void sdl_audio_callback(void *opaque, Uint8 *stream, int len)
}
}
static int audio_open(void *opaque, int64_t wanted_channel_layout, int wanted_nb_channels, int wanted_sample_rate, struct AudioParams *audio_hw_params)
static int audio_open(void *opaque, AVChannelLayout *wanted_channel_layout, int wanted_sample_rate, struct AudioParams *audio_hw_params)
{
SDL_AudioSpec wanted_spec, spec;
const char *env;
static const int next_nb_channels[] = {0, 0, 1, 6, 2, 6, 4, 6};
static const int next_sample_rates[] = {0, 44100, 48000, 96000, 192000};
int next_sample_rate_idx = FF_ARRAY_ELEMS(next_sample_rates) - 1;
int wanted_nb_channels = wanted_channel_layout->nb_channels;
env = SDL_getenv("SDL_AUDIO_CHANNELS");
if (env) {
wanted_nb_channels = atoi(env);
wanted_channel_layout = av_get_default_channel_layout(wanted_nb_channels);
av_channel_layout_uninit(wanted_channel_layout);
av_channel_layout_default(wanted_channel_layout, wanted_nb_channels);
}
if (!wanted_channel_layout || wanted_nb_channels != av_get_channel_layout_nb_channels(wanted_channel_layout)) {
wanted_channel_layout = av_get_default_channel_layout(wanted_nb_channels);
wanted_channel_layout &= ~AV_CH_LAYOUT_STEREO_DOWNMIX;
if (wanted_channel_layout->order != AV_CHANNEL_ORDER_NATIVE) {
av_channel_layout_uninit(wanted_channel_layout);
av_channel_layout_default(wanted_channel_layout, wanted_nb_channels);
}
wanted_nb_channels = av_get_channel_layout_nb_channels(wanted_channel_layout);
wanted_nb_channels = wanted_channel_layout->nb_channels;
wanted_spec.channels = wanted_nb_channels;
wanted_spec.freq = wanted_sample_rate;
if (wanted_spec.freq <= 0 || wanted_spec.channels <= 0) {
@ -2539,7 +2521,7 @@ static int audio_open(void *opaque, int64_t wanted_channel_layout, int wanted_nb
return -1;
}
}
wanted_channel_layout = av_get_default_channel_layout(wanted_spec.channels);
av_channel_layout_default(wanted_channel_layout, wanted_spec.channels);
}
if (spec.format != AUDIO_S16SYS) {
av_log(NULL, AV_LOG_ERROR,
@ -2547,8 +2529,9 @@ static int audio_open(void *opaque, int64_t wanted_channel_layout, int wanted_nb
return -1;
}
if (spec.channels != wanted_spec.channels) {
wanted_channel_layout = av_get_default_channel_layout(spec.channels);
if (!wanted_channel_layout) {
av_channel_layout_uninit(wanted_channel_layout);
av_channel_layout_default(wanted_channel_layout, spec.channels);
if (wanted_channel_layout->order != AV_CHANNEL_ORDER_NATIVE) {
av_log(NULL, AV_LOG_ERROR,
"SDL advised channel count %d is not supported!\n", spec.channels);
return -1;
@ -2557,10 +2540,10 @@ static int audio_open(void *opaque, int64_t wanted_channel_layout, int wanted_nb
audio_hw_params->fmt = AV_SAMPLE_FMT_S16;
audio_hw_params->freq = spec.freq;
audio_hw_params->channel_layout = wanted_channel_layout;
audio_hw_params->channels = spec.channels;
audio_hw_params->frame_size = av_samples_get_buffer_size(NULL, audio_hw_params->channels, 1, audio_hw_params->fmt, 1);
audio_hw_params->bytes_per_sec = av_samples_get_buffer_size(NULL, audio_hw_params->channels, audio_hw_params->freq, audio_hw_params->fmt, 1);
if (av_channel_layout_copy(&audio_hw_params->ch_layout, wanted_channel_layout) < 0)
return -1;
audio_hw_params->frame_size = av_samples_get_buffer_size(NULL, audio_hw_params->ch_layout.nb_channels, 1, audio_hw_params->fmt, 1);
audio_hw_params->bytes_per_sec = av_samples_get_buffer_size(NULL, audio_hw_params->ch_layout.nb_channels, audio_hw_params->freq, audio_hw_params->fmt, 1);
if (audio_hw_params->bytes_per_sec <= 0 || audio_hw_params->frame_size <= 0) {
av_log(NULL, AV_LOG_ERROR, "av_samples_get_buffer_size failed\n");
return -1;
@ -2576,9 +2559,9 @@ static int stream_component_open(VideoState *is, int stream_index)
const AVCodec *codec;
const char *forced_codec_name = NULL;
AVDictionary *opts = NULL;
AVDictionaryEntry *t = NULL;
int sample_rate, nb_channels;
int64_t channel_layout;
const AVDictionaryEntry *t = NULL;
int sample_rate;
AVChannelLayout ch_layout = { 0 };
int ret = 0;
int stream_lowres = lowres;
@ -2646,24 +2629,27 @@ static int stream_component_open(VideoState *is, int stream_index)
AVFilterContext *sink;
is->audio_filter_src.freq = avctx->sample_rate;
is->audio_filter_src.channels = avctx->channels;
is->audio_filter_src.channel_layout = get_valid_channel_layout(avctx->channel_layout, avctx->channels);
ret = av_channel_layout_copy(&is->audio_filter_src.ch_layout, &avctx->ch_layout);
if (ret < 0)
goto fail;
is->audio_filter_src.fmt = avctx->sample_fmt;
if ((ret = configure_audio_filters(is, afilters, 0)) < 0)
goto fail;
sink = is->out_audio_filter;
sample_rate = av_buffersink_get_sample_rate(sink);
nb_channels = av_buffersink_get_channels(sink);
channel_layout = av_buffersink_get_channel_layout(sink);
ret = av_buffersink_get_ch_layout(sink, &ch_layout);
if (ret < 0)
goto fail;
}
#else
sample_rate = avctx->sample_rate;
nb_channels = avctx->channels;
channel_layout = avctx->channel_layout;
ret = av_channel_layout_copy(&ch_layout, &avctx->ch_layout);
if (ret < 0)
goto fail;
#endif
/* prepare audio output */
if ((ret = audio_open(is, channel_layout, nb_channels, sample_rate, &is->audio_tgt)) < 0)
if ((ret = audio_open(is, &ch_layout, sample_rate, &is->audio_tgt)) < 0)
goto fail;
is->audio_hw_buf_size = ret;
is->audio_src = is->audio_tgt;
@ -2717,6 +2703,7 @@ static int stream_component_open(VideoState *is, int stream_index)
fail:
avcodec_free_context(&avctx);
out:
av_channel_layout_uninit(&ch_layout);
av_dict_free(&opts);
return ret;
@ -2761,7 +2748,7 @@ static int read_thread(void *arg)
AVPacket *pkt = NULL;
int64_t stream_start_time;
int pkt_in_play_range = 0;
AVDictionaryEntry *t;
const AVDictionaryEntry *t;
SDL_mutex *wait_mutex = SDL_CreateMutex();
int scan_all_pmts_set = 0;
int64_t pkt_ts;
@ -2836,7 +2823,9 @@ static int read_thread(void *arg)
ic->pb->eof_reached = 0; // FIXME hack, ffplay maybe should not use avio_feof() to test for the end
if (seek_by_bytes < 0)
seek_by_bytes = !!(ic->iformat->flags & AVFMT_TS_DISCONT) && strcmp("ogg", ic->iformat->name);
seek_by_bytes = !(ic->iformat->flags & AVFMT_NO_BYTE_SEEK) &&
!!(ic->iformat->flags & AVFMT_TS_DISCONT) &&
strcmp("ogg", ic->iformat->name);
is->max_frame_duration = (ic->iformat->flags & AVFMT_TS_DISCONT) ? 10.0 : 3600.0;
@ -3075,7 +3064,8 @@ static int read_thread(void *arg)
return 0;
}
static VideoState *stream_open(const char *filename, AVInputFormat *iformat)
static VideoState *stream_open(const char *filename,
const AVInputFormat *iformat)
{
VideoState *is;
@ -3188,7 +3178,7 @@ static void stream_cycle_channel(VideoState *is, int codec_type)
switch (codec_type) {
case AVMEDIA_TYPE_AUDIO:
if (st->codecpar->sample_rate != 0 &&
st->codecpar->channels != 0)
st->codecpar->ch_layout.nb_channels != 0)
goto the_end;
break;
case AVMEDIA_TYPE_VIDEO:
@ -3474,12 +3464,6 @@ static void event_loop(VideoState *cur_stream)
}
}
static int opt_frame_size(void *optctx, const char *opt, const char *arg)
{
av_log(NULL, AV_LOG_WARNING, "Option -s is deprecated, use -video_size.\n");
return opt_default(NULL, "video_size", arg);
}
static int opt_width(void *optctx, const char *opt, const char *arg)
{
screen_width = parse_number_or_die(opt, arg, OPT_INT64, 1, INT_MAX);
@ -3502,12 +3486,6 @@ static int opt_format(void *optctx, const char *opt, const char *arg)
return 0;
}
static int opt_frame_pix_fmt(void *optctx, const char *opt, const char *arg)
{
av_log(NULL, AV_LOG_WARNING, "Option -pix_fmt is deprecated, use -pixel_format.\n");
return opt_default(NULL, "pixel_format", arg);
}
static int opt_sync(void *optctx, const char *opt, const char *arg)
{
if (!strcmp(arg, "audio"))
@ -3585,7 +3563,6 @@ static const OptionDef options[] = {
CMDUTILS_COMMON_OPTIONS
{ "x", HAS_ARG, { .func_arg = opt_width }, "force displayed width", "width" },
{ "y", HAS_ARG, { .func_arg = opt_height }, "force displayed height", "height" },
{ "s", HAS_ARG | OPT_VIDEO, { .func_arg = opt_frame_size }, "set frame size (WxH or abbreviation)", "size" },
{ "fs", OPT_BOOL, { &is_full_screen }, "force full screen" },
{ "an", OPT_BOOL, { &audio_disable }, "disable audio" },
{ "vn", OPT_BOOL, { &video_disable }, "disable video" },
@ -3602,7 +3579,6 @@ static const OptionDef options[] = {
{ "alwaysontop", OPT_BOOL, { &alwaysontop }, "window always on top" },
{ "volume", OPT_INT | HAS_ARG, { &startup_volume}, "set startup volume 0=min 100=max", "volume" },
{ "f", HAS_ARG, { .func_arg = opt_format }, "force format", "fmt" },
{ "pix_fmt", HAS_ARG | OPT_EXPERT | OPT_VIDEO, { .func_arg = opt_frame_pix_fmt }, "set pixel format", "format" },
{ "stats", OPT_BOOL | OPT_EXPERT, { &show_status }, "show status", "" },
{ "fast", OPT_BOOL | OPT_EXPERT, { &fast }, "non spec compliant optimizations", "" },
{ "genpts", OPT_BOOL | OPT_EXPERT, { &genpts }, "generate pts", "" },
@ -3624,7 +3600,6 @@ static const OptionDef options[] = {
#endif
{ "rdftspeed", OPT_INT | HAS_ARG| OPT_AUDIO | OPT_EXPERT, { &rdftspeed }, "rdft speed", "msecs" },
{ "showmode", HAS_ARG, { .func_arg = opt_show_mode}, "select show mode (0 = video, 1 = waves, 2 = RDFT)", "mode" },
{ "default", HAS_ARG | OPT_AUDIO | OPT_VIDEO | OPT_EXPERT, { .func_arg = opt_default }, "generic catch all option", "" },
{ "i", OPT_BOOL, { &dummy}, "read specified file", "input_file"},
{ "codec", HAS_ARG, { .func_arg = opt_codec}, "force decoder", "decoder_name" },
{ "acodec", HAS_ARG | OPT_STRING | OPT_EXPERT, { &audio_codec_name }, "force audio decoder", "decoder_name" },
@ -3696,8 +3671,6 @@ int main(int argc, char **argv)
#endif
avformat_network_init();
init_opts();
signal(SIGINT , sigterm_handler); /* Interrupt (ANSI). */
signal(SIGTERM, sigterm_handler); /* Termination (ANSI). */
@ -3748,6 +3721,10 @@ int main(int argc, char **argv)
flags |= SDL_WINDOW_BORDERLESS;
else
flags |= SDL_WINDOW_RESIZABLE;
#ifdef SDL_HINT_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR
SDL_SetHint(SDL_HINT_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR, "0");
#endif
window = SDL_CreateWindow(program_name, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, default_width, default_height, flags);
SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "linear");
if (window) {

File diff suppressed because it is too large Load Diff

71
fftools/fopen_utf8.h Normal file
View File

@ -0,0 +1,71 @@
/*
* 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 FFTOOLS_FOPEN_UTF8_H
#define FFTOOLS_FOPEN_UTF8_H
#include <stdio.h>
/* The fopen_utf8 function here is essentially equivalent to avpriv_fopen_utf8,
* except that it doesn't set O_CLOEXEC, and that it isn't exported
* from a different library. (On Windows, each DLL might use a different
* CRT, and FILE* handles can't be shared across them.) */
#ifdef _WIN32
#include "libavutil/wchar_filename.h"
static inline FILE *fopen_utf8(const char *path_utf8, const char *mode)
{
wchar_t *path_w, *mode_w;
FILE *f;
/* convert UTF-8 to wide chars */
if (get_extended_win32_path(path_utf8, &path_w)) /* This sets errno on error. */
return NULL;
if (!path_w)
goto fallback;
if (utf8towchar(mode, &mode_w))
return NULL;
if (!mode_w) {
/* If failing to interpret the mode string as utf8, it is an invalid
* parameter. */
av_freep(&path_w);
errno = EINVAL;
return NULL;
}
f = _wfopen(path_w, mode_w);
av_freep(&path_w);
av_freep(&mode_w);
return f;
fallback:
/* path may be in CP_ACP */
return fopen(path_utf8, mode);
}
#else
static inline FILE *fopen_utf8(const char *path, const char *mode)
{
return fopen(path, mode);
}
#endif
#endif /* FFTOOLS_FOPEN_UTF8_H */

1465
fftools/opt_common.c Normal file

File diff suppressed because it is too large Load Diff

231
fftools/opt_common.h Normal file
View File

@ -0,0 +1,231 @@
/*
* Option handlers shared between the tools.
*
* 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 FFTOOLS_OPT_COMMON_H
#define FFTOOLS_OPT_COMMON_H
#include "config.h"
#include "cmdutils.h"
#if CONFIG_AVDEVICE
/**
* Print a listing containing autodetected sinks of the output device.
* Device name with options may be passed as an argument to limit results.
*/
int show_sinks(void *optctx, const char *opt, const char *arg);
/**
* Print a listing containing autodetected sources of the input device.
* Device name with options may be passed as an argument to limit results.
*/
int show_sources(void *optctx, const char *opt, const char *arg);
#endif
#if CONFIG_AVDEVICE
#define CMDUTILS_COMMON_OPTIONS_AVDEVICE \
{ "sources" , OPT_EXIT | HAS_ARG, { .func_arg = show_sources }, \
"list sources of the input device", "device" }, \
{ "sinks" , OPT_EXIT | HAS_ARG, { .func_arg = show_sinks }, \
"list sinks of the output device", "device" }, \
#else
#define CMDUTILS_COMMON_OPTIONS_AVDEVICE
#endif
/**
* Print the license of the program to stdout. The license depends on
* the license of the libraries compiled into the program.
* This option processing function does not utilize the arguments.
*/
int show_license(void *optctx, const char *opt, const char *arg);
/**
* Generic -h handler common to all fftools.
*/
int show_help(void *optctx, const char *opt, const char *arg);
/**
* Print the version of the program to stdout. The version message
* depends on the current versions of the repository and of the libav*
* libraries.
* This option processing function does not utilize the arguments.
*/
int show_version(void *optctx, const char *opt, const char *arg);
/**
* Print the build configuration of the program to stdout. The contents
* depend on the definition of FFMPEG_CONFIGURATION.
* This option processing function does not utilize the arguments.
*/
int show_buildconf(void *optctx, const char *opt, const char *arg);
/**
* Print a listing containing all the formats supported by the
* program (including devices).
* This option processing function does not utilize the arguments.
*/
int show_formats(void *optctx, const char *opt, const char *arg);
/**
* Print a listing containing all the muxers supported by the
* program (including devices).
* This option processing function does not utilize the arguments.
*/
int show_muxers(void *optctx, const char *opt, const char *arg);
/**
* Print a listing containing all the demuxer supported by the
* program (including devices).
* This option processing function does not utilize the arguments.
*/
int show_demuxers(void *optctx, const char *opt, const char *arg);
/**
* Print a listing containing all the devices supported by the
* program.
* This option processing function does not utilize the arguments.
*/
int show_devices(void *optctx, const char *opt, const char *arg);
/**
* Print a listing containing all the codecs supported by the
* program.
* This option processing function does not utilize the arguments.
*/
int show_codecs(void *optctx, const char *opt, const char *arg);
/**
* Print a listing containing all the decoders supported by the
* program.
*/
int show_decoders(void *optctx, const char *opt, const char *arg);
/**
* Print a listing containing all the encoders supported by the
* program.
*/
int show_encoders(void *optctx, const char *opt, const char *arg);
/**
* Print a listing containing all the bit stream filters supported by the
* program.
* This option processing function does not utilize the arguments.
*/
int show_bsfs(void *optctx, const char *opt, const char *arg);
/**
* Print a listing containing all the protocols supported by the
* program.
* This option processing function does not utilize the arguments.
*/
int show_protocols(void *optctx, const char *opt, const char *arg);
/**
* Print a listing containing all the filters supported by the
* program.
* This option processing function does not utilize the arguments.
*/
int show_filters(void *optctx, const char *opt, const char *arg);
/**
* Print a listing containing all the pixel formats supported by the
* program.
* This option processing function does not utilize the arguments.
*/
int show_pix_fmts(void *optctx, const char *opt, const char *arg);
/**
* Print a listing containing all the standard channel layouts supported by
* the program.
* This option processing function does not utilize the arguments.
*/
int show_layouts(void *optctx, const char *opt, const char *arg);
/**
* Print a listing containing all the sample formats supported by the
* program.
*/
int show_sample_fmts(void *optctx, const char *opt, const char *arg);
/**
* Print a listing containing all supported stream dispositions.
*/
int show_dispositions(void *optctx, const char *opt, const char *arg);
/**
* Print a listing containing all the color names and values recognized
* by the program.
*/
int show_colors(void *optctx, const char *opt, const char *arg);
/**
* Set the libav* libraries log level.
*/
int opt_loglevel(void *optctx, const char *opt, const char *arg);
int opt_report(void *optctx, const char *opt, const char *arg);
int init_report(const char *env, FILE **file);
int opt_max_alloc(void *optctx, const char *opt, const char *arg);
/**
* Override the cpuflags.
*/
int opt_cpuflags(void *optctx, const char *opt, const char *arg);
/**
* Override the cpucount.
*/
int opt_cpucount(void *optctx, const char *opt, const char *arg);
#define CMDUTILS_COMMON_OPTIONS \
{ "L", OPT_EXIT, { .func_arg = show_license }, "show license" }, \
{ "h", OPT_EXIT, { .func_arg = show_help }, "show help", "topic" }, \
{ "?", OPT_EXIT, { .func_arg = show_help }, "show help", "topic" }, \
{ "help", OPT_EXIT, { .func_arg = show_help }, "show help", "topic" }, \
{ "-help", OPT_EXIT, { .func_arg = show_help }, "show help", "topic" }, \
{ "version", OPT_EXIT, { .func_arg = show_version }, "show version" }, \
{ "buildconf", OPT_EXIT, { .func_arg = show_buildconf }, "show build configuration" }, \
{ "formats", OPT_EXIT, { .func_arg = show_formats }, "show available formats" }, \
{ "muxers", OPT_EXIT, { .func_arg = show_muxers }, "show available muxers" }, \
{ "demuxers", OPT_EXIT, { .func_arg = show_demuxers }, "show available demuxers" }, \
{ "devices", OPT_EXIT, { .func_arg = show_devices }, "show available devices" }, \
{ "codecs", OPT_EXIT, { .func_arg = show_codecs }, "show available codecs" }, \
{ "decoders", OPT_EXIT, { .func_arg = show_decoders }, "show available decoders" }, \
{ "encoders", OPT_EXIT, { .func_arg = show_encoders }, "show available encoders" }, \
{ "bsfs", OPT_EXIT, { .func_arg = show_bsfs }, "show available bit stream filters" }, \
{ "protocols", OPT_EXIT, { .func_arg = show_protocols }, "show available protocols" }, \
{ "filters", OPT_EXIT, { .func_arg = show_filters }, "show available filters" }, \
{ "pix_fmts", OPT_EXIT, { .func_arg = show_pix_fmts }, "show available pixel formats" }, \
{ "layouts", OPT_EXIT, { .func_arg = show_layouts }, "show standard channel layouts" }, \
{ "sample_fmts", OPT_EXIT, { .func_arg = show_sample_fmts }, "show available audio sample formats" }, \
{ "dispositions", OPT_EXIT, { .func_arg = show_dispositions}, "show available stream dispositions" }, \
{ "colors", OPT_EXIT, { .func_arg = show_colors }, "show available color names" }, \
{ "loglevel", HAS_ARG, { .func_arg = opt_loglevel }, "set logging level", "loglevel" }, \
{ "v", HAS_ARG, { .func_arg = opt_loglevel }, "set logging level", "loglevel" }, \
{ "report", 0, { .func_arg = opt_report }, "generate a report" }, \
{ "max_alloc", HAS_ARG, { .func_arg = opt_max_alloc }, "set maximum size of a single allocated block", "bytes" }, \
{ "cpuflags", HAS_ARG | OPT_EXPERT, { .func_arg = opt_cpuflags }, "force specific cpu flags", "flags" }, \
{ "cpucount", HAS_ARG | OPT_EXPERT, { .func_arg = opt_cpucount }, "force specific cpu count", "count" }, \
{ "hide_banner", OPT_BOOL | OPT_EXPERT, {&hide_banner}, "do not show program banner", "hide_banner" }, \
CMDUTILS_COMMON_OPTIONS_AVDEVICE \
#endif /* FFTOOLS_OPT_COMMON_H */

View File

@ -21,6 +21,7 @@
*/
#include "avcodec.h"
#include "codec_internal.h"
#include "internal.h"
#include "libavutil/intreadwrite.h"
@ -35,12 +36,11 @@ static av_cold int zero12v_decode_init(AVCodecContext *avctx)
return 0;
}
static int zero12v_decode_frame(AVCodecContext *avctx, void *data,
static int zero12v_decode_frame(AVCodecContext *avctx, AVFrame *pic,
int *got_frame, AVPacket *avpkt)
{
int line, ret;
const int width = avctx->width;
AVFrame *pic = data;
uint16_t *y, *u, *v;
const uint8_t *line_end, *src = avpkt->data;
int stride = avctx->width * 8 / 3;
@ -131,8 +131,8 @@ static int zero12v_decode_frame(AVCodecContext *avctx, void *data,
u = x/2 + (uint16_t *)(pic->data[1] + line * pic->linesize[1]);
v = x/2 + (uint16_t *)(pic->data[2] + line * pic->linesize[2]);
memcpy(y, y_temp, sizeof(*y) * (width - x));
memcpy(u, u_temp, sizeof(*u) * (width - x + 1) / 2);
memcpy(v, v_temp, sizeof(*v) * (width - x + 1) / 2);
memcpy(u, u_temp, sizeof(*u) * ((width - x + 1) / 2));
memcpy(v, v_temp, sizeof(*v) * ((width - x + 1) / 2));
}
line_end += stride;
@ -144,12 +144,13 @@ static int zero12v_decode_frame(AVCodecContext *avctx, void *data,
return avpkt->size;
}
AVCodec ff_zero12v_decoder = {
.name = "012v",
.long_name = NULL_IF_CONFIG_SMALL("Uncompressed 4:2:2 10-bit"),
.type = AVMEDIA_TYPE_VIDEO,
.id = AV_CODEC_ID_012V,
const FFCodec ff_zero12v_decoder = {
.p.name = "012v",
.p.long_name = NULL_IF_CONFIG_SMALL("Uncompressed 4:2:2 10-bit"),
.p.type = AVMEDIA_TYPE_VIDEO,
.p.id = AV_CODEC_ID_012V,
.init = zero12v_decode_init,
.decode = zero12v_decode_frame,
.capabilities = AV_CODEC_CAP_DR1,
FF_CODEC_DECODE_CB(zero12v_decode_frame),
.p.capabilities = AV_CODEC_CAP_DR1,
.caps_internal = FF_CODEC_CAP_INIT_THREADSAFE,
};

View File

@ -31,10 +31,12 @@
#include "libavutil/imgutils.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/mem_internal.h"
#include "libavutil/thread.h"
#include "avcodec.h"
#include "blockdsp.h"
#include "bswapdsp.h"
#include "bytestream.h"
#include "codec_internal.h"
#include "get_bits.h"
#include "internal.h"
@ -246,9 +248,9 @@ static void idct(int16_t block[64])
}
}
static av_cold void init_vlcs(FourXContext *f)
static av_cold void init_vlcs(void)
{
static VLC_TYPE table[2][4][32][2];
static VLCElem table[2][4][32];
int i, j;
for (i = 0; i < 2; i++) {
@ -832,13 +834,12 @@ static int decode_i_frame(FourXContext *f, const uint8_t *buf, int length)
return 0;
}
static int decode_frame(AVCodecContext *avctx, void *data,
static int decode_frame(AVCodecContext *avctx, AVFrame *picture,
int *got_frame, AVPacket *avpkt)
{
const uint8_t *buf = avpkt->data;
int buf_size = avpkt->size;
FourXContext *const f = avctx->priv_data;
AVFrame *picture = data;
int i, frame_4cc, frame_size, ret;
if (buf_size < 20)
@ -886,6 +887,8 @@ static int decode_frame(AVCodecContext *avctx, void *data,
}
if (i >= CFRAME_BUFFER_COUNT) {
if (free_index < 0)
return AVERROR_INVALIDDATA;
i = free_index;
f->cfrm[i].id = id;
}
@ -988,6 +991,7 @@ static av_cold int decode_end(AVCodecContext *avctx)
static av_cold int decode_init(AVCodecContext *avctx)
{
static AVOnce init_static_once = AV_ONCE_INIT;
FourXContext * const f = avctx->priv_data;
int ret;
@ -1006,33 +1010,33 @@ static av_cold int decode_init(AVCodecContext *avctx)
f->frame_buffer = av_mallocz(avctx->width * avctx->height * 2);
f->last_frame_buffer = av_mallocz(avctx->width * avctx->height * 2);
if (!f->frame_buffer || !f->last_frame_buffer) {
decode_end(avctx);
if (!f->frame_buffer || !f->last_frame_buffer)
return AVERROR(ENOMEM);
}
f->version = AV_RL32(avctx->extradata) >> 16;
ff_blockdsp_init(&f->bdsp, avctx);
ff_bswapdsp_init(&f->bbdsp);
f->avctx = avctx;
init_vlcs(f);
if (f->version > 2)
avctx->pix_fmt = AV_PIX_FMT_RGB565;
else
avctx->pix_fmt = AV_PIX_FMT_BGR555;
ff_thread_once(&init_static_once, init_vlcs);
return 0;
}
AVCodec ff_fourxm_decoder = {
.name = "4xm",
.long_name = NULL_IF_CONFIG_SMALL("4X Movie"),
.type = AVMEDIA_TYPE_VIDEO,
.id = AV_CODEC_ID_4XM,
const FFCodec ff_fourxm_decoder = {
.p.name = "4xm",
.p.long_name = NULL_IF_CONFIG_SMALL("4X Movie"),
.p.type = AVMEDIA_TYPE_VIDEO,
.p.id = AV_CODEC_ID_4XM,
.priv_data_size = sizeof(FourXContext),
.init = decode_init,
.close = decode_end,
.decode = decode_frame,
.capabilities = AV_CODEC_CAP_DR1,
FF_CODEC_DECODE_CB(decode_frame),
.p.capabilities = AV_CODEC_CAP_DR1,
.caps_internal = FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_INIT_CLEANUP,
};

View File

@ -37,6 +37,8 @@
#include "libavutil/internal.h"
#include "libavutil/intreadwrite.h"
#include "avcodec.h"
#include "codec_internal.h"
#include "decode.h"
#include "internal.h"
@ -52,10 +54,9 @@ typedef struct EightBpsContext {
uint32_t pal[256];
} EightBpsContext;
static int decode_frame(AVCodecContext *avctx, void *data,
static int decode_frame(AVCodecContext *avctx, AVFrame *frame,
int *got_frame, AVPacket *avpkt)
{
AVFrame *frame = data;
const uint8_t *buf = avpkt->data;
int buf_size = avpkt->size;
EightBpsContext * const c = avctx->priv_data;
@ -70,6 +71,9 @@ static int decode_frame(AVCodecContext *avctx, void *data,
unsigned char *planemap = c->planemap;
int ret;
if (buf_size < planes * height *2)
return AVERROR_INVALIDDATA;
if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)
return ret;
@ -122,16 +126,7 @@ static int decode_frame(AVCodecContext *avctx, void *data,
}
if (avctx->bits_per_coded_sample <= 8) {
buffer_size_t size;
const uint8_t *pal = av_packet_get_side_data(avpkt,
AV_PKT_DATA_PALETTE,
&size);
if (pal && size == AVPALETTE_SIZE) {
frame->palette_has_changed = 1;
memcpy(c->pal, pal, AVPALETTE_SIZE);
} else if (pal) {
av_log(avctx, AV_LOG_ERROR, "Palette size %d is wrong\n", size);
}
frame->palette_has_changed = ff_copy_palette(c->pal, avpkt, avctx);
memcpy (frame->data[1], c->pal, AVPALETTE_SIZE);
}
@ -181,13 +176,14 @@ static av_cold int decode_init(AVCodecContext *avctx)
return 0;
}
AVCodec ff_eightbps_decoder = {
.name = "8bps",
.long_name = NULL_IF_CONFIG_SMALL("QuickTime 8BPS video"),
.type = AVMEDIA_TYPE_VIDEO,
.id = AV_CODEC_ID_8BPS,
const FFCodec ff_eightbps_decoder = {
.p.name = "8bps",
.p.long_name = NULL_IF_CONFIG_SMALL("QuickTime 8BPS video"),
.p.type = AVMEDIA_TYPE_VIDEO,
.p.id = AV_CODEC_ID_8BPS,
.priv_data_size = sizeof(EightBpsContext),
.init = decode_init,
.decode = decode_frame,
.capabilities = AV_CODEC_CAP_DR1,
FF_CODEC_DECODE_CB(decode_frame),
.p.capabilities = AV_CODEC_CAP_DR1,
.caps_internal = FF_CODEC_CAP_INIT_THREADSAFE,
};

View File

@ -37,8 +37,11 @@
* http://aminet.net/mods/smpl/
*/
#include "config_components.h"
#include "libavutil/avassert.h"
#include "avcodec.h"
#include "codec_internal.h"
#include "internal.h"
#include "libavutil/common.h"
@ -83,43 +86,43 @@ static void delta_decode(uint8_t *dst, const uint8_t *src, int src_size,
}
/** decode a frame */
static int eightsvx_decode_frame(AVCodecContext *avctx, void *data,
static int eightsvx_decode_frame(AVCodecContext *avctx, AVFrame *frame,
int *got_frame_ptr, AVPacket *avpkt)
{
EightSvxContext *esc = avctx->priv_data;
AVFrame *frame = data;
int channels = avctx->ch_layout.nb_channels;
int buf_size;
int ch, ret;
int hdr_size = 2;
/* decode and interleave the first packet */
if (!esc->data[0] && avpkt) {
int chan_size = avpkt->size / avctx->channels - hdr_size;
int chan_size = avpkt->size / channels - hdr_size;
if (avpkt->size % avctx->channels) {
if (avpkt->size % channels) {
av_log(avctx, AV_LOG_WARNING, "Packet with odd size, ignoring last byte\n");
}
if (avpkt->size < (hdr_size + 1) * avctx->channels) {
if (avpkt->size < (hdr_size + 1) * channels) {
av_log(avctx, AV_LOG_ERROR, "packet size is too small\n");
return AVERROR_INVALIDDATA;
}
esc->fib_acc[0] = avpkt->data[1] + 128;
if (avctx->channels == 2)
if (channels == 2)
esc->fib_acc[1] = avpkt->data[2+chan_size+1] + 128;
esc->data_idx = 0;
esc->data_size = chan_size;
if (!(esc->data[0] = av_malloc(chan_size)))
return AVERROR(ENOMEM);
if (avctx->channels == 2) {
if (channels == 2) {
if (!(esc->data[1] = av_malloc(chan_size))) {
av_freep(&esc->data[0]);
return AVERROR(ENOMEM);
}
}
memcpy(esc->data[0], &avpkt->data[hdr_size], chan_size);
if (avctx->channels == 2)
if (channels == 2)
memcpy(esc->data[1], &avpkt->data[2*hdr_size+chan_size], chan_size);
}
if (!esc->data[0]) {
@ -139,7 +142,7 @@ static int eightsvx_decode_frame(AVCodecContext *avctx, void *data,
if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)
return ret;
for (ch = 0; ch < avctx->channels; ch++) {
for (ch = 0; ch < channels; ch++) {
delta_decode(frame->data[ch], &esc->data[ch][esc->data_idx],
buf_size, &esc->fib_acc[ch], esc->table);
}
@ -148,14 +151,14 @@ static int eightsvx_decode_frame(AVCodecContext *avctx, void *data,
*got_frame_ptr = 1;
return ((avctx->frame_number == 0)*hdr_size + buf_size)*avctx->channels;
return ((avctx->frame_number == 0) * hdr_size + buf_size) * channels;
}
static av_cold int eightsvx_decode_init(AVCodecContext *avctx)
{
EightSvxContext *esc = avctx->priv_data;
if (avctx->channels < 1 || avctx->channels > 2) {
if (avctx->ch_layout.nb_channels < 1 || avctx->ch_layout.nb_channels > 2) {
av_log(avctx, AV_LOG_ERROR, "8SVX does not support more than 2 channels\n");
return AVERROR_INVALIDDATA;
}
@ -184,32 +187,34 @@ static av_cold int eightsvx_decode_close(AVCodecContext *avctx)
}
#if CONFIG_EIGHTSVX_FIB_DECODER
AVCodec ff_eightsvx_fib_decoder = {
.name = "8svx_fib",
.long_name = NULL_IF_CONFIG_SMALL("8SVX fibonacci"),
.type = AVMEDIA_TYPE_AUDIO,
.id = AV_CODEC_ID_8SVX_FIB,
const FFCodec ff_eightsvx_fib_decoder = {
.p.name = "8svx_fib",
.p.long_name = NULL_IF_CONFIG_SMALL("8SVX fibonacci"),
.p.type = AVMEDIA_TYPE_AUDIO,
.p.id = AV_CODEC_ID_8SVX_FIB,
.priv_data_size = sizeof (EightSvxContext),
.init = eightsvx_decode_init,
.decode = eightsvx_decode_frame,
FF_CODEC_DECODE_CB(eightsvx_decode_frame),
.close = eightsvx_decode_close,
.capabilities = AV_CODEC_CAP_DR1,
.sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_U8P,
.p.capabilities = AV_CODEC_CAP_DR1,
.p.sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_U8P,
AV_SAMPLE_FMT_NONE },
.caps_internal = FF_CODEC_CAP_INIT_THREADSAFE,
};
#endif
#if CONFIG_EIGHTSVX_EXP_DECODER
AVCodec ff_eightsvx_exp_decoder = {
.name = "8svx_exp",
.long_name = NULL_IF_CONFIG_SMALL("8SVX exponential"),
.type = AVMEDIA_TYPE_AUDIO,
.id = AV_CODEC_ID_8SVX_EXP,
const FFCodec ff_eightsvx_exp_decoder = {
.p.name = "8svx_exp",
.p.long_name = NULL_IF_CONFIG_SMALL("8SVX exponential"),
.p.type = AVMEDIA_TYPE_AUDIO,
.p.id = AV_CODEC_ID_8SVX_EXP,
.priv_data_size = sizeof (EightSvxContext),
.init = eightsvx_decode_init,
.decode = eightsvx_decode_frame,
FF_CODEC_DECODE_CB(eightsvx_decode_frame),
.close = eightsvx_decode_close,
.capabilities = AV_CODEC_CAP_DR1,
.sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_U8P,
.p.capabilities = AV_CODEC_CAP_DR1,
.p.sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_U8P,
AV_SAMPLE_FMT_NONE },
.caps_internal = FF_CODEC_CAP_INIT_THREADSAFE,
};
#endif

View File

@ -12,6 +12,7 @@ HEADERS = ac3_parser.h \
codec_id.h \
codec_par.h \
d3d11va.h \
defs.h \
dirac.h \
dv_profile.h \
dxva2.h \
@ -19,9 +20,9 @@ HEADERS = ac3_parser.h \
mediacodec.h \
packet.h \
qsv.h \
vaapi.h \
vdpau.h \
version.h \
version_major.h \
videotoolbox.h \
vorbis_parser.h \
xvmc.h \
@ -32,9 +33,7 @@ OBJS = ac3_parser.o \
avcodec.o \
avdct.o \
avpacket.o \
avpicture.o \
bitstream.o \
bitstream_filter.o \
bitstream_filters.o \
bsf.o \
codec_desc.o \
@ -44,6 +43,7 @@ OBJS = ac3_parser.o \
dirac.o \
dv_profile.o \
encode.o \
get_buffer.o \
imgconvert.o \
jni.o \
mathtables.o \
@ -56,13 +56,15 @@ OBJS = ac3_parser.o \
qsv_api.o \
raw.o \
utils.o \
version.o \
vlc.o \
vorbis_parser.o \
xiph.o \
# subsystems
OBJS-$(CONFIG_AANDCTTABLES) += aandcttab.o
OBJS-$(CONFIG_AC3DSP) += ac3dsp.o ac3.o ac3tab.o
OBJS-$(CONFIG_ADTS_HEADER) += adts_header.o mpeg4audio.o
OBJS-$(CONFIG_ADTS_HEADER) += adts_header.o mpeg4audio_sample_rates.o
OBJS-$(CONFIG_AMF) += amfenc.o
OBJS-$(CONFIG_AUDIO_FRAME_QUEUE) += audio_frame_queue.o
OBJS-$(CONFIG_ATSC_A53) += atsc_a53.o
@ -79,6 +81,8 @@ OBJS-$(CONFIG_CBS_MPEG2) += cbs_mpeg2.o
OBJS-$(CONFIG_CBS_VP9) += cbs_vp9.o
OBJS-$(CONFIG_CRYSTALHD) += crystalhd.o
OBJS-$(CONFIG_DCT) += dct.o dct32_fixed.o dct32_float.o
OBJS-$(CONFIG_DEFLATE_WRAPPER) += zlib_wrapper.o
OBJS-$(CONFIG_DOVI_RPU) += dovi_rpu.o
OBJS-$(CONFIG_ERROR_RESILIENCE) += error_resilience.o
OBJS-$(CONFIG_EXIF) += exif.o tiff_common.o
OBJS-$(CONFIG_FAANDCT) += faandct.o
@ -97,7 +101,7 @@ OBJS-$(CONFIG_H264PARSE) += h264_parse.o h2645_parse.o h264_ps.o
OBJS-$(CONFIG_H264PRED) += h264pred.o
OBJS-$(CONFIG_H264QPEL) += h264qpel.o
OBJS-$(CONFIG_HEVCPARSE) += hevc_parse.o h2645_parse.o hevc_ps.o hevc_sei.o hevc_data.o \
dynamic_hdr10_plus.o
dynamic_hdr10_plus.o dynamic_hdr_vivid.o
OBJS-$(CONFIG_HPELDSP) += hpeldsp.o
OBJS-$(CONFIG_HUFFMAN) += huffman.o
OBJS-$(CONFIG_HUFFYUVDSP) += huffyuvdsp.o
@ -105,6 +109,7 @@ OBJS-$(CONFIG_HUFFYUVENCDSP) += huffyuvencdsp.o
OBJS-$(CONFIG_IDCTDSP) += idctdsp.o simple_idct.o jrevdct.o
OBJS-$(CONFIG_IIRFILTER) += iirfilter.o
OBJS-$(CONFIG_MDCT15) += mdct15.o
OBJS-$(CONFIG_INFLATE_WRAPPER) += zlib_wrapper.o
OBJS-$(CONFIG_INTRAX8) += intrax8.o intrax8dsp.o msmpeg4data.o
OBJS-$(CONFIG_IVIDSP) += ivi_dsp.o
OBJS-$(CONFIG_JNI) += ffjni.o jni.o
@ -119,20 +124,23 @@ OBJS-$(CONFIG_MDCT) += mdct_float.o mdct_fixed_32.o
OBJS-$(CONFIG_ME_CMP) += me_cmp.o
OBJS-$(CONFIG_MEDIACODEC) += mediacodecdec_common.o mediacodec_surface.o mediacodec_wrapper.o mediacodec_sw_buffer.o
OBJS-$(CONFIG_MPEG_ER) += mpeg_er.o
OBJS-$(CONFIG_MPEGAUDIO) += mpegaudio.o mpegaudiodec_common.o
OBJS-$(CONFIG_MPEGAUDIO) += mpegaudio.o mpegaudiodec_common.o \
mpegaudiodata.o
OBJS-$(CONFIG_MPEGAUDIODSP) += mpegaudiodsp.o \
mpegaudiodsp_data.o \
mpegaudiodsp_fixed.o \
mpegaudiodsp_float.o
OBJS-$(CONFIG_MPEGAUDIOHEADER) += mpegaudiodecheader.o mpegaudiodata.o
OBJS-$(CONFIG_MPEGAUDIOHEADER) += mpegaudiodecheader.o mpegaudiotabs.o
OBJS-$(CONFIG_MPEG4AUDIO) += mpeg4audio.o mpeg4audio_sample_rates.o
OBJS-$(CONFIG_MPEGVIDEO) += mpegvideo.o mpegvideodsp.o rl.o \
mpegvideo_motion.o mpegutils.o \
mpegvideodata.o mpegpicture.o
mpegvideo_motion.o \
mpegvideodata.o mpegpicture.o \
to_upper4.o
OBJS-$(CONFIG_MPEGVIDEODEC) += mpegvideo_dec.o mpegutils.o
OBJS-$(CONFIG_MPEGVIDEOENC) += mpegvideo_enc.o mpeg12data.o \
motion_est.o ratecontrol.o \
mpegvideoencdsp.o
OBJS-$(CONFIG_MSS34DSP) += mss34dsp.o
OBJS-$(CONFIG_NVENC) += nvenc.o
OBJS-$(CONFIG_PIXBLOCKDSP) += pixblockdsp.o
OBJS-$(CONFIG_QPELDSP) += qpeldsp.o
OBJS-$(CONFIG_QSV) += qsv.o
@ -141,7 +149,6 @@ OBJS-$(CONFIG_QSVENC) += qsvenc.o
OBJS-$(CONFIG_RANGECODER) += rangecoder.o
OBJS-$(CONFIG_RDFT) += rdft.o
OBJS-$(CONFIG_RV34DSP) += rv34dsp.o
OBJS-$(CONFIG_SHARED) += log2_tab.o reverse.o
OBJS-$(CONFIG_SINEWIN) += sinewin.o
OBJS-$(CONFIG_SNAPPY) += snappy.o
OBJS-$(CONFIG_STARTCODE) += startcode.o
@ -163,10 +170,10 @@ OBJS-$(CONFIG_ZERO12V_DECODER) += 012v.o
OBJS-$(CONFIG_A64MULTI_ENCODER) += a64multienc.o elbg.o
OBJS-$(CONFIG_A64MULTI5_ENCODER) += a64multienc.o elbg.o
OBJS-$(CONFIG_AAC_DECODER) += aacdec.o aactab.o aacsbr.o aacps_common.o aacps_float.o \
mpeg4audio.o kbdwin.o \
kbdwin.o \
sbrdsp.o aacpsdsp_float.o cbrt_data.o
OBJS-$(CONFIG_AAC_FIXED_DECODER) += aacdec_fixed.o aactab.o aacsbr_fixed.o aacps_common.o aacps_fixed.o \
mpeg4audio.o kbdwin.o \
kbdwin.o \
sbrdsp_fixed.o aacpsdsp_fixed.o cbrt_data_fixed.o
OBJS-$(CONFIG_AAC_ENCODER) += aacenc.o aaccoder.o aacenctab.o \
aacpsy.o aactab.o \
@ -174,11 +181,14 @@ OBJS-$(CONFIG_AAC_ENCODER) += aacenc.o aaccoder.o aacenctab.o \
aacenc_tns.o \
aacenc_ltp.o \
aacenc_pred.o \
psymodel.o mpeg4audio.o kbdwin.o
psymodel.o kbdwin.o \
mpeg4audio_sample_rates.o
OBJS-$(CONFIG_AAC_MF_ENCODER) += mfenc.o mf_utils.o
OBJS-$(CONFIG_AASC_DECODER) += aasc.o msrledec.o
OBJS-$(CONFIG_AC3_DECODER) += ac3dec_float.o ac3dec_data.o ac3.o kbdwin.o ac3tab.o
OBJS-$(CONFIG_AC3_FIXED_DECODER) += ac3dec_fixed.o ac3dec_data.o ac3.o kbdwin.o ac3tab.o
OBJS-$(CONFIG_AC3_DECODER) += ac3dec_float.o ac3dec_data.o ac3.o \
kbdwin.o ac3tab.o ac3_channel_layout_tab.o
OBJS-$(CONFIG_AC3_FIXED_DECODER) += ac3dec_fixed.o ac3dec_data.o ac3.o \
kbdwin.o ac3tab.o ac3_channel_layout_tab.o
OBJS-$(CONFIG_AC3_ENCODER) += ac3enc_float.o ac3enc.o ac3tab.o \
ac3.o kbdwin.o
OBJS-$(CONFIG_AC3_FIXED_ENCODER) += ac3enc_fixed.o ac3enc.o ac3tab.o ac3.o kbdwin.o
@ -190,7 +200,7 @@ OBJS-$(CONFIG_ALAC_DECODER) += alac.o alac_data.o alacdsp.o
OBJS-$(CONFIG_ALAC_ENCODER) += alacenc.o alac_data.o
OBJS-$(CONFIG_ALIAS_PIX_DECODER) += aliaspixdec.o
OBJS-$(CONFIG_ALIAS_PIX_ENCODER) += aliaspixenc.o
OBJS-$(CONFIG_ALS_DECODER) += alsdec.o bgmc.o mlz.o mpeg4audio.o
OBJS-$(CONFIG_ALS_DECODER) += alsdec.o bgmc.o mlz.o
OBJS-$(CONFIG_AMRNB_DECODER) += amrnbdec.o celp_filters.o \
celp_math.o acelp_filters.o \
acelp_vectors.o \
@ -199,8 +209,7 @@ OBJS-$(CONFIG_AMRWB_DECODER) += amrwbdec.o celp_filters.o \
celp_math.o acelp_filters.o \
acelp_vectors.o \
acelp_pitch_delay.o
OBJS-$(CONFIG_AMV_ENCODER) += mjpegenc.o mjpegenc_common.o \
mjpegenc_huffman.o
OBJS-$(CONFIG_AMV_ENCODER) += mjpegenc.o mjpegenc_common.o
OBJS-$(CONFIG_ANM_DECODER) += anm.o
OBJS-$(CONFIG_ANSI_DECODER) += ansi.o cga_data.o
OBJS-$(CONFIG_APE_DECODER) += apedec.o
@ -246,7 +255,8 @@ OBJS-$(CONFIG_BINK_DECODER) += bink.o binkdsp.o
OBJS-$(CONFIG_BINKAUDIO_DCT_DECODER) += binkaudio.o
OBJS-$(CONFIG_BINKAUDIO_RDFT_DECODER) += binkaudio.o
OBJS-$(CONFIG_BINTEXT_DECODER) += bintext.o cga_data.o
OBJS-$(CONFIG_BITPACKED_DECODER) += bitpacked.o
OBJS-$(CONFIG_BITPACKED_DECODER) += bitpacked_dec.o
OBJS-$(CONFIG_BITPACKED_ENCODER) += bitpacked_enc.o
OBJS-$(CONFIG_BMP_DECODER) += bmp.o msrledec.o
OBJS-$(CONFIG_BMP_ENCODER) += bmpenc.o
OBJS-$(CONFIG_BMV_AUDIO_DECODER) += bmvaudio.o
@ -276,7 +286,8 @@ OBJS-$(CONFIG_CSCD_DECODER) += cscd.o
OBJS-$(CONFIG_CYUV_DECODER) += cyuv.o
OBJS-$(CONFIG_DCA_DECODER) += dcadec.o dca.o dcadata.o dcahuff.o \
dca_core.o dca_exss.o dca_xll.o dca_lbr.o \
dcadsp.o dcadct.o synth_filter.o
dcadsp.o dcadct.o dca_sample_rate_tab.o \
synth_filter.o
OBJS-$(CONFIG_DCA_ENCODER) += dcaenc.o dcadata.o dcahuff.o \
dcaadpcm.o
OBJS-$(CONFIG_DDS_DECODER) += dds.o
@ -284,6 +295,8 @@ OBJS-$(CONFIG_DERF_DPCM_DECODER) += dpcm.o
OBJS-$(CONFIG_DIRAC_DECODER) += diracdec.o dirac.o diracdsp.o diractab.o \
dirac_arith.o dirac_dwt.o dirac_vlc.o
OBJS-$(CONFIG_DFA_DECODER) += dfa.o
OBJS-$(CONFIG_DFPWM_DECODER) += dfpwmdec.o
OBJS-$(CONFIG_DFPWM_ENCODER) += dfpwmenc.o
OBJS-$(CONFIG_DNXHD_DECODER) += dnxhddec.o dnxhddata.o
OBJS-$(CONFIG_DNXHD_ENCODER) += dnxhdenc.o dnxhddata.o
OBJS-$(CONFIG_DOLBY_E_DECODER) += dolby_e.o dolby_e_parse.o kbdwin.o
@ -314,7 +327,8 @@ OBJS-$(CONFIG_EAMAD_DECODER) += eamad.o eaidct.o mpeg12.o \
mpeg12data.o
OBJS-$(CONFIG_EATGQ_DECODER) += eatgq.o eaidct.o
OBJS-$(CONFIG_EATGV_DECODER) += eatgv.o
OBJS-$(CONFIG_EATQI_DECODER) += eatqi.o eaidct.o mpeg12.o mpeg12data.o mpegvideodata.o rl.o
OBJS-$(CONFIG_EATQI_DECODER) += eatqi.o eaidct.o mpeg12.o \
mpeg12data.o mpegvideodata.o
OBJS-$(CONFIG_EIGHTBPS_DECODER) += 8bps.o
OBJS-$(CONFIG_EIGHTSVX_EXP_DECODER) += 8svx.o
OBJS-$(CONFIG_EIGHTSVX_FIB_DECODER) += 8svx.o
@ -350,6 +364,7 @@ OBJS-$(CONFIG_G723_1_ENCODER) += g723_1enc.o g723_1.o \
acelp_vectors.o celp_filters.o celp_math.o
OBJS-$(CONFIG_G729_DECODER) += g729dec.o lsp.o celp_math.o celp_filters.o acelp_filters.o acelp_pitch_delay.o acelp_vectors.o g729postfilter.o
OBJS-$(CONFIG_GDV_DECODER) += gdv.o
OBJS-$(CONFIG_GEM_DECODER) += gemdec.o
OBJS-$(CONFIG_GIF_DECODER) += gifdec.o lzw.o
OBJS-$(CONFIG_GIF_ENCODER) += gif.o lzwenc.o
OBJS-$(CONFIG_GREMLIN_DPCM_DECODER) += dpcm.o
@ -369,15 +384,13 @@ OBJS-$(CONFIG_H264_DECODER) += h264dec.o h264_cabac.o h264_cavlc.o \
h264_direct.o h264_loopfilter.o \
h264_mb.o h264_picture.o \
h264_refs.o h264_sei.o \
h264_slice.o h264data.o
h264_slice.o h264data.o h274.o
OBJS-$(CONFIG_H264_AMF_ENCODER) += amfenc_h264.o
OBJS-$(CONFIG_H264_CUVID_DECODER) += cuviddec.o
OBJS-$(CONFIG_H264_MEDIACODEC_DECODER) += mediacodecdec.o
OBJS-$(CONFIG_H264_MF_ENCODER) += mfenc.o mf_utils.o
OBJS-$(CONFIG_H264_MMAL_DECODER) += mmaldec.o
OBJS-$(CONFIG_H264_NVENC_ENCODER) += nvenc_h264.o
OBJS-$(CONFIG_NVENC_ENCODER) += nvenc_h264.o
OBJS-$(CONFIG_NVENC_H264_ENCODER) += nvenc_h264.o
OBJS-$(CONFIG_H264_NVENC_ENCODER) += nvenc_h264.o nvenc.o
OBJS-$(CONFIG_H264_OMX_ENCODER) += omx.o
OBJS-$(CONFIG_H264_QSV_DECODER) += qsvdec.o
OBJS-$(CONFIG_H264_QSV_ENCODER) += qsvenc_h264.o
@ -392,13 +405,13 @@ OBJS-$(CONFIG_HCA_DECODER) += hcadec.o
OBJS-$(CONFIG_HCOM_DECODER) += hcom.o
OBJS-$(CONFIG_HEVC_DECODER) += hevcdec.o hevc_mvs.o \
hevc_cabac.o hevc_refs.o hevcpred.o \
hevcdsp.o hevc_filter.o hevc_data.o
hevcdsp.o hevc_filter.o hevc_data.o \
h274.o
OBJS-$(CONFIG_HEVC_AMF_ENCODER) += amfenc_hevc.o
OBJS-$(CONFIG_HEVC_CUVID_DECODER) += cuviddec.o
OBJS-$(CONFIG_HEVC_MEDIACODEC_DECODER) += mediacodecdec.o
OBJS-$(CONFIG_HEVC_MF_ENCODER) += mfenc.o mf_utils.o
OBJS-$(CONFIG_HEVC_NVENC_ENCODER) += nvenc_hevc.o
OBJS-$(CONFIG_NVENC_HEVC_ENCODER) += nvenc_hevc.o
OBJS-$(CONFIG_HEVC_NVENC_ENCODER) += nvenc_hevc.o nvenc.o
OBJS-$(CONFIG_HEVC_QSV_DECODER) += qsvdec.o
OBJS-$(CONFIG_HEVC_QSV_ENCODER) += qsvenc_hevc.o hevc_ps_enc.o \
hevc_data.o
@ -406,6 +419,7 @@ OBJS-$(CONFIG_HEVC_RKMPP_DECODER) += rkmppdec.o
OBJS-$(CONFIG_HEVC_VAAPI_ENCODER) += vaapi_encode_h265.o h265_profile_level.o
OBJS-$(CONFIG_HEVC_V4L2M2M_DECODER) += v4l2_m2m_dec.o
OBJS-$(CONFIG_HEVC_V4L2M2M_ENCODER) += v4l2_m2m_enc.o
OBJS-$(CONFIG_HEVC_VIDEOTOOLBOX_ENCODER) += videotoolboxenc.o
OBJS-$(CONFIG_HNM4_VIDEO_DECODER) += hnm4video.o
OBJS-$(CONFIG_HQ_HQA_DECODER) += hq_hqa.o hq_hqadata.o hq_hqadsp.o \
canopus.o
@ -471,17 +485,19 @@ OBJS-$(CONFIG_MP1_DECODER) += mpegaudiodec_fixed.o
OBJS-$(CONFIG_MP1FLOAT_DECODER) += mpegaudiodec_float.o
OBJS-$(CONFIG_MP2_DECODER) += mpegaudiodec_fixed.o
OBJS-$(CONFIG_MP2_ENCODER) += mpegaudioenc_float.o mpegaudio.o \
mpegaudiodata.o mpegaudiodsp_data.o
mpegaudiodata.o mpegaudiodsp_data.o \
mpegaudiotabs.o
OBJS-$(CONFIG_MP2FIXED_ENCODER) += mpegaudioenc_fixed.o mpegaudio.o \
mpegaudiodata.o mpegaudiodsp_data.o
mpegaudiodata.o mpegaudiodsp_data.o \
mpegaudiotabs.o
OBJS-$(CONFIG_MP2FLOAT_DECODER) += mpegaudiodec_float.o
OBJS-$(CONFIG_MP3_DECODER) += mpegaudiodec_fixed.o
OBJS-$(CONFIG_MP3_MF_ENCODER) += mfenc.o mf_utils.o
OBJS-$(CONFIG_MP3ADU_DECODER) += mpegaudiodec_fixed.o
OBJS-$(CONFIG_MP3ADUFLOAT_DECODER) += mpegaudiodec_float.o
OBJS-$(CONFIG_MP3FLOAT_DECODER) += mpegaudiodec_float.o
OBJS-$(CONFIG_MP3ON4_DECODER) += mpegaudiodec_fixed.o mpeg4audio.o
OBJS-$(CONFIG_MP3ON4FLOAT_DECODER) += mpegaudiodec_float.o mpeg4audio.o
OBJS-$(CONFIG_MP3ON4_DECODER) += mpegaudiodec_fixed.o
OBJS-$(CONFIG_MP3ON4FLOAT_DECODER) += mpegaudiodec_float.o
OBJS-$(CONFIG_MPC7_DECODER) += mpc7.o mpc.o
OBJS-$(CONFIG_MPC8_DECODER) += mpc8.o mpc.o
OBJS-$(CONFIG_MPEGVIDEO_DECODER) += mpeg12dec.o mpeg12.o mpeg12data.o
@ -513,6 +529,7 @@ OBJS-$(CONFIG_MSMPEG4V2_DECODER) += msmpeg4dec.o msmpeg4.o msmpeg4data.o
OBJS-$(CONFIG_MSMPEG4V2_ENCODER) += msmpeg4enc.o msmpeg4.o msmpeg4data.o
OBJS-$(CONFIG_MSMPEG4V3_DECODER) += msmpeg4dec.o msmpeg4.o msmpeg4data.o
OBJS-$(CONFIG_MSMPEG4V3_ENCODER) += msmpeg4enc.o msmpeg4.o msmpeg4data.o
OBJS-$(CONFIG_MSNSIREN_DECODER) += siren.o
OBJS-$(CONFIG_MSP2_DECODER) += msp2dec.o
OBJS-$(CONFIG_MSRLE_DECODER) += msrle.o msrledec.o
OBJS-$(CONFIG_MSS1_DECODER) += mss1.o mss12.o
@ -554,6 +571,8 @@ OBJS-$(CONFIG_PGMYUV_DECODER) += pnmdec.o pnm.o
OBJS-$(CONFIG_PGMYUV_ENCODER) += pnmenc.o
OBJS-$(CONFIG_PGSSUB_DECODER) += pgssubdec.o
OBJS-$(CONFIG_PGX_DECODER) += pgxdec.o
OBJS-$(CONFIG_PHM_DECODER) += pnmdec.o pnm.o
OBJS-$(CONFIG_PHM_ENCODER) += pnmenc.o
OBJS-$(CONFIG_PHOTOCD_DECODER) += photocd.o
OBJS-$(CONFIG_PICTOR_DECODER) += pictordec.o cga_data.o
OBJS-$(CONFIG_PIXLET_DECODER) += pixlet.o
@ -566,6 +585,7 @@ OBJS-$(CONFIG_PRORES_DECODER) += proresdec2.o proresdsp.o proresdata.o
OBJS-$(CONFIG_PRORES_ENCODER) += proresenc_anatoliy.o proresdata.o
OBJS-$(CONFIG_PRORES_AW_ENCODER) += proresenc_anatoliy.o proresdata.o
OBJS-$(CONFIG_PRORES_KS_ENCODER) += proresenc_kostya.o proresdata.o
OBJS-$(CONFIG_PRORES_VIDEOTOOLBOX_ENCODER) += videotoolboxenc.o
OBJS-$(CONFIG_PROSUMER_DECODER) += prosumer.o
OBJS-$(CONFIG_PSD_DECODER) += psd.o
OBJS-$(CONFIG_PTX_DECODER) += ptx.o
@ -575,6 +595,8 @@ OBJS-$(CONFIG_QCELP_DECODER) += qcelpdec.o \
OBJS-$(CONFIG_QDM2_DECODER) += qdm2.o
OBJS-$(CONFIG_QDMC_DECODER) += qdmc.o
OBJS-$(CONFIG_QDRAW_DECODER) += qdrw.o
OBJS-$(CONFIG_QOI_DECODER) += qoidec.o
OBJS-$(CONFIG_QOI_ENCODER) += qoienc.o
OBJS-$(CONFIG_QPEG_DECODER) += qpeg.o
OBJS-$(CONFIG_QTRLE_DECODER) += qtrle.o
OBJS-$(CONFIG_QTRLE_ENCODER) += qtrleenc.o
@ -626,6 +648,7 @@ OBJS-$(CONFIG_SIMBIOSIS_IMX_DECODER) += imx.o
OBJS-$(CONFIG_SMACKAUD_DECODER) += smacker.o
OBJS-$(CONFIG_SMACKER_DECODER) += smacker.o
OBJS-$(CONFIG_SMC_DECODER) += smc.o
OBJS-$(CONFIG_SMC_ENCODER) += smcenc.o
OBJS-$(CONFIG_SNOW_DECODER) += snowdec.o snow.o snow_dwt.o
OBJS-$(CONFIG_SNOW_ENCODER) += snowenc.o snow.o snow_dwt.o \
h263.o h263data.o ituh263enc.o
@ -635,6 +658,7 @@ OBJS-$(CONFIG_SONIC_ENCODER) += sonic.o
OBJS-$(CONFIG_SONIC_LS_ENCODER) += sonic.o
OBJS-$(CONFIG_SPEEDHQ_DECODER) += speedhq.o mpeg12.o mpeg12data.o simple_idct.o
OBJS-$(CONFIG_SPEEDHQ_ENCODER) += speedhq.o mpeg12data.o mpeg12enc.o speedhqenc.o
OBJS-$(CONFIG_SPEEX_DECODER) += speexdec.o
OBJS-$(CONFIG_SP5X_DECODER) += sp5xdec.o
OBJS-$(CONFIG_SRGC_DECODER) += mscc.o
OBJS-$(CONFIG_SRT_DECODER) += srtdec.o ass.o htmlsubtitles.o
@ -690,6 +714,8 @@ OBJS-$(CONFIG_V408_ENCODER) += v408enc.o
OBJS-$(CONFIG_V410_DECODER) += v410dec.o
OBJS-$(CONFIG_V410_ENCODER) += v410enc.o
OBJS-$(CONFIG_VB_DECODER) += vb.o
OBJS-$(CONFIG_VBN_DECODER) += vbndec.o
OBJS-$(CONFIG_VBN_ENCODER) += vbnenc.o
OBJS-$(CONFIG_VBLE_DECODER) += vble.o
OBJS-$(CONFIG_VC1_DECODER) += vc1dec.o vc1_block.o vc1_loopfilter.o \
vc1_mc.o vc1_pred.o vc1.o vc1data.o \
@ -788,6 +814,7 @@ OBJS-$(CONFIG_ZMBV_ENCODER) += zmbvenc.o
# (AD)PCM decoders/encoders
OBJS-$(CONFIG_PCM_ALAW_DECODER) += pcm.o
OBJS-$(CONFIG_PCM_ALAW_ENCODER) += pcm.o
OBJS-$(CONFIG_PCM_BLURAY_ENCODER) += pcm-blurayenc.o
OBJS-$(CONFIG_PCM_BLURAY_DECODER) += pcm-bluray.o
OBJS-$(CONFIG_PCM_DVD_DECODER) += pcm-dvd.o
OBJS-$(CONFIG_PCM_DVD_ENCODER) += pcm-dvdenc.o
@ -859,7 +886,7 @@ OBJS-$(CONFIG_ADPCM_AFC_DECODER) += adpcm.o adpcm_data.o
OBJS-$(CONFIG_ADPCM_AGM_DECODER) += adpcm.o adpcm_data.o
OBJS-$(CONFIG_ADPCM_AICA_DECODER) += adpcm.o adpcm_data.o
OBJS-$(CONFIG_ADPCM_ARGO_DECODER) += adpcm.o adpcm_data.o
OBJS-$(CONFIG_ADPCM_ARGO_ENCODER) += adpcm.o adpcmenc.o
OBJS-$(CONFIG_ADPCM_ARGO_ENCODER) += adpcm.o adpcm_data.o adpcmenc.o
OBJS-$(CONFIG_ADPCM_CT_DECODER) += adpcm.o adpcm_data.o
OBJS-$(CONFIG_ADPCM_DTK_DECODER) += adpcm.o adpcm_data.o
OBJS-$(CONFIG_ADPCM_EA_DECODER) += adpcm.o adpcm_data.o
@ -874,7 +901,9 @@ OBJS-$(CONFIG_ADPCM_G726_DECODER) += g726.o
OBJS-$(CONFIG_ADPCM_G726_ENCODER) += g726.o
OBJS-$(CONFIG_ADPCM_G726LE_DECODER) += g726.o
OBJS-$(CONFIG_ADPCM_G726LE_ENCODER) += g726.o
OBJS-$(CONFIG_ADPCM_IMA_ACORN_DECODER) += adpcm.o adpcm_data.o
OBJS-$(CONFIG_ADPCM_IMA_AMV_DECODER) += adpcm.o adpcm_data.o
OBJS-$(CONFIG_ADPCM_IMA_AMV_ENCODER) += adpcmenc.o adpcm_data.o
OBJS-$(CONFIG_ADPCM_IMA_ALP_DECODER) += adpcm.o adpcm_data.o
OBJS-$(CONFIG_ADPCM_IMA_ALP_ENCODER) += adpcmenc.o adpcm_data.o
OBJS-$(CONFIG_ADPCM_IMA_APC_DECODER) += adpcm.o adpcm_data.o
@ -899,6 +928,7 @@ OBJS-$(CONFIG_ADPCM_IMA_SMJPEG_DECODER) += adpcm.o adpcm_data.o
OBJS-$(CONFIG_ADPCM_IMA_WAV_DECODER) += adpcm.o adpcm_data.o
OBJS-$(CONFIG_ADPCM_IMA_WAV_ENCODER) += adpcmenc.o adpcm_data.o
OBJS-$(CONFIG_ADPCM_IMA_WS_DECODER) += adpcm.o adpcm_data.o
OBJS-$(CONFIG_ADPCM_IMA_WS_ENCODER) += adpcmenc.o adpcm_data.o
OBJS-$(CONFIG_ADPCM_MS_DECODER) += adpcm.o adpcm_data.o
OBJS-$(CONFIG_ADPCM_MS_ENCODER) += adpcmenc.o adpcm_data.o
OBJS-$(CONFIG_ADPCM_MTAF_DECODER) += adpcm.o adpcm_data.o
@ -928,6 +958,7 @@ OBJS-$(CONFIG_AV1_D3D11VA_HWACCEL) += dxva2_av1.o
OBJS-$(CONFIG_AV1_DXVA2_HWACCEL) += dxva2_av1.o
OBJS-$(CONFIG_AV1_NVDEC_HWACCEL) += nvdec_av1.o
OBJS-$(CONFIG_AV1_VAAPI_HWACCEL) += vaapi_av1.o
OBJS-$(CONFIG_AV1_VDPAU_HWACCEL) += vdpau_av1.o
OBJS-$(CONFIG_H263_VAAPI_HWACCEL) += vaapi_mpeg4.o
OBJS-$(CONFIG_H263_VIDEOTOOLBOX_HWACCEL) += videotoolbox.o
OBJS-$(CONFIG_H264_D3D11VA_HWACCEL) += dxva2_h264.o
@ -948,7 +979,6 @@ OBJS-$(CONFIG_MJPEG_VAAPI_HWACCEL) += vaapi_mjpeg.o
OBJS-$(CONFIG_MPEG1_NVDEC_HWACCEL) += nvdec_mpeg12.o
OBJS-$(CONFIG_MPEG1_VDPAU_HWACCEL) += vdpau_mpeg12.o
OBJS-$(CONFIG_MPEG1_VIDEOTOOLBOX_HWACCEL) += videotoolbox.o
OBJS-$(CONFIG_MPEG1_XVMC_HWACCEL) += mpegvideo_xvmc.o
OBJS-$(CONFIG_MPEG2_D3D11VA_HWACCEL) += dxva2_mpeg2.o
OBJS-$(CONFIG_MPEG2_DXVA2_HWACCEL) += dxva2_mpeg2.o
OBJS-$(CONFIG_MPEG2_NVDEC_HWACCEL) += nvdec_mpeg12.o
@ -956,7 +986,6 @@ OBJS-$(CONFIG_MPEG2_QSV_HWACCEL) += qsvdec.o
OBJS-$(CONFIG_MPEG2_VAAPI_HWACCEL) += vaapi_mpeg2.o
OBJS-$(CONFIG_MPEG2_VDPAU_HWACCEL) += vdpau_mpeg12.o
OBJS-$(CONFIG_MPEG2_VIDEOTOOLBOX_HWACCEL) += videotoolbox.o
OBJS-$(CONFIG_MPEG2_XVMC_HWACCEL) += mpegvideo_xvmc.o
OBJS-$(CONFIG_MPEG4_NVDEC_HWACCEL) += nvdec_mpeg4.o
OBJS-$(CONFIG_MPEG4_VAAPI_HWACCEL) += vaapi_mpeg4.o
OBJS-$(CONFIG_MPEG4_VDPAU_HWACCEL) += vdpau_mpeg4.o
@ -974,28 +1003,30 @@ OBJS-$(CONFIG_VP9_DXVA2_HWACCEL) += dxva2_vp9.o
OBJS-$(CONFIG_VP9_NVDEC_HWACCEL) += nvdec_vp9.o
OBJS-$(CONFIG_VP9_VAAPI_HWACCEL) += vaapi_vp9.o
OBJS-$(CONFIG_VP9_VDPAU_HWACCEL) += vdpau_vp9.o
OBJS-$(CONFIG_VP9_VIDEOTOOLBOX_HWACCEL) += videotoolbox_vp9.o
OBJS-$(CONFIG_VP8_QSV_HWACCEL) += qsvdec.o
# libavformat dependencies
OBJS-$(CONFIG_ISO_MEDIA) += mpeg4audio.o mpegaudiodata.o
# Objects duplicated from other libraries for shared builds
SHLIBOBJS += log2_tab.o reverse.o
OBJS-$(CONFIG_ADTS_MUXER) += mpeg4audio.o
OBJS-$(CONFIG_CODEC2_DEMUXER) += codec2utils.o
OBJS-$(CONFIG_CODEC2_MUXER) += codec2utils.o
OBJS-$(CONFIG_CODEC2RAW_DEMUXER) += codec2utils.o
OBJS-$(CONFIG_DNXHD_DEMUXER) += dnxhddata.o
# General libavformat dependencies
OBJS-$(CONFIG_FITS_DEMUXER) += fits.o
OBJS-$(CONFIG_LATM_MUXER) += mpeg4audio.o
OBJS-$(CONFIG_MATROSKA_AUDIO_MUXER) += mpeg4audio.o
OBJS-$(CONFIG_MATROSKA_MUXER) += mpeg4audio.o
OBJS-$(CONFIG_MOV_DEMUXER) += ac3tab.o
OBJS-$(CONFIG_MATROSKA_DEMUXER) += mpeg4audio.o
OBJS-$(CONFIG_MXF_MUXER) += dnxhddata.o
OBJS-$(CONFIG_NUT_MUXER) += mpegaudiodata.o
OBJS-$(CONFIG_RTP_MUXER) += mpeg4audio.o
OBJS-$(CONFIG_SPDIF_MUXER) += dca.o
OBJS-$(CONFIG_TAK_DEMUXER) += tak.o
OBJS-$(CONFIG_WEBM_MUXER) += mpeg4audio.o
# libavformat dependencies for static builds
STLIBOBJS-$(CONFIG_AVFORMAT) += to_upper4.o
STLIBOBJS-$(CONFIG_ISO_MEDIA) += mpegaudiotabs.o
STLIBOBJS-$(CONFIG_FLV_MUXER) += mpeg4audio_sample_rates.o
STLIBOBJS-$(CONFIG_HLS_DEMUXER) += ac3_channel_layout_tab.o
STLIBOBJS-$(CONFIG_MATROSKA_DEMUXER) += mpeg4audio_sample_rates.o
STLIBOBJS-$(CONFIG_MOV_DEMUXER) += ac3_channel_layout_tab.o
STLIBOBJS-$(CONFIG_MXF_MUXER) += golomb.o
STLIBOBJS-$(CONFIG_MP3_MUXER) += mpegaudiotabs.o
STLIBOBJS-$(CONFIG_NUT_MUXER) += mpegaudiotabs.o
STLIBOBJS-$(CONFIG_RTPDEC) += jpegtables.o
STLIBOBJS-$(CONFIG_RTP_MUXER) += golomb.o jpegtables.o \
mpeg4audio_sample_rates.o
STLIBOBJS-$(CONFIG_SPDIF_MUXER) += dca_sample_rate_tab.o
# libavfilter dependencies
OBJS-$(CONFIG_ELBG_FILTER) += elbg.o
@ -1025,8 +1056,8 @@ OBJS-$(CONFIG_LIBAOM_AV1_DECODER) += libaomdec.o
OBJS-$(CONFIG_LIBAOM_AV1_ENCODER) += libaomenc.o
OBJS-$(CONFIG_LIBARIBB24_DECODER) += libaribb24.o ass.o
OBJS-$(CONFIG_LIBCELT_DECODER) += libcelt_dec.o
OBJS-$(CONFIG_LIBCODEC2_DECODER) += libcodec2.o codec2utils.o
OBJS-$(CONFIG_LIBCODEC2_ENCODER) += libcodec2.o codec2utils.o
OBJS-$(CONFIG_LIBCODEC2_DECODER) += libcodec2.o
OBJS-$(CONFIG_LIBCODEC2_ENCODER) += libcodec2.o
OBJS-$(CONFIG_LIBDAV1D_DECODER) += libdav1d.o
OBJS-$(CONFIG_LIBDAVS2_DECODER) += libdavs2.o
OBJS-$(CONFIG_LIBFDK_AAC_DECODER) += libfdk-aacdec.o
@ -1037,6 +1068,8 @@ OBJS-$(CONFIG_LIBGSM_MS_DECODER) += libgsmdec.o
OBJS-$(CONFIG_LIBGSM_MS_ENCODER) += libgsmenc.o
OBJS-$(CONFIG_LIBILBC_DECODER) += libilbc.o
OBJS-$(CONFIG_LIBILBC_ENCODER) += libilbc.o
OBJS-$(CONFIG_LIBJXL_DECODER) += libjxldec.o libjxl.o
OBJS-$(CONFIG_LIBJXL_ENCODER) += libjxlenc.o libjxl.o
OBJS-$(CONFIG_LIBKVAZAAR_ENCODER) += libkvazaar.o
OBJS-$(CONFIG_LIBMP3LAME_ENCODER) += libmp3lame.o
OBJS-$(CONFIG_LIBOPENCORE_AMRNB_DECODER) += libopencore-amr.o
@ -1078,19 +1111,21 @@ OBJS-$(CONFIG_LIBZVBI_TELETEXT_DECODER) += libzvbi-teletextdec.o ass.o
# parsers
OBJS-$(CONFIG_AAC_LATM_PARSER) += latm_parser.o
OBJS-$(CONFIG_AAC_PARSER) += aac_parser.o aac_ac3_parser.o \
mpeg4audio.o
OBJS-$(CONFIG_AC3_PARSER) += ac3tab.o aac_ac3_parser.o
OBJS-$(CONFIG_AAC_PARSER) += aac_parser.o aac_ac3_parser.o
OBJS-$(CONFIG_AC3_PARSER) += aac_ac3_parser.o ac3tab.o \
ac3_channel_layout_tab.o
OBJS-$(CONFIG_ADX_PARSER) += adx_parser.o adx.o
OBJS-$(CONFIG_AV1_PARSER) += av1_parser.o av1_parse.o
OBJS-$(CONFIG_AVS2_PARSER) += avs2_parser.o
OBJS-$(CONFIG_AMR_PARSER) += amr_parser.o
OBJS-$(CONFIG_AV1_PARSER) += av1_parser.o
OBJS-$(CONFIG_AVS2_PARSER) += avs2.o avs2_parser.o
OBJS-$(CONFIG_AVS3_PARSER) += avs3_parser.o
OBJS-$(CONFIG_AV3A_PARSER) += av3a_parser.o
OBJS-$(CONFIG_BMP_PARSER) += bmp_parser.o
OBJS-$(CONFIG_CAVSVIDEO_PARSER) += cavs_parser.o
OBJS-$(CONFIG_COOK_PARSER) += cook_parser.o
OBJS-$(CONFIG_CRI_PARSER) += cri_parser.o
OBJS-$(CONFIG_DCA_PARSER) += dca_parser.o dca_exss.o dca.o
OBJS-$(CONFIG_DCA_PARSER) += dca_parser.o dca_exss.o dca.o \
dca_sample_rate_tab.o
OBJS-$(CONFIG_DIRAC_PARSER) += dirac_parser.o
OBJS-$(CONFIG_DNXHD_PARSER) += dnxhd_parser.o dnxhddata.o
OBJS-$(CONFIG_DOLBY_E_PARSER) += dolby_e_parser.o dolby_e_parse.o
@ -1122,6 +1157,7 @@ OBJS-$(CONFIG_OPUS_PARSER) += opus_parser.o opus.o opustab.o \
opus_rc.o vorbis_data.o
OBJS-$(CONFIG_PNG_PARSER) += png_parser.o
OBJS-$(CONFIG_PNM_PARSER) += pnm_parser.o pnm.o
OBJS-$(CONFIG_QOI_PARSER) += qoi_parser.o
OBJS-$(CONFIG_RV30_PARSER) += rv34_parser.o
OBJS-$(CONFIG_RV40_PARSER) += rv34_parser.o
OBJS-$(CONFIG_SBC_PARSER) += sbc_parser.o
@ -1137,13 +1173,14 @@ OBJS-$(CONFIG_XBM_PARSER) += xbm_parser.o
OBJS-$(CONFIG_XMA_PARSER) += xma_parser.o
# bitstream filters
OBJS-$(CONFIG_AAC_ADTSTOASC_BSF) += aac_adtstoasc_bsf.o mpeg4audio.o
OBJS-$(CONFIG_AAC_ADTSTOASC_BSF) += aac_adtstoasc_bsf.o
OBJS-$(CONFIG_AV1_METADATA_BSF) += av1_metadata_bsf.o
OBJS-$(CONFIG_AV1_FRAME_MERGE_BSF) += av1_frame_merge_bsf.o
OBJS-$(CONFIG_AV1_FRAME_SPLIT_BSF) += av1_frame_split_bsf.o
OBJS-$(CONFIG_CHOMP_BSF) += chomp_bsf.o
OBJS-$(CONFIG_DUMP_EXTRADATA_BSF) += dump_extradata_bsf.o
OBJS-$(CONFIG_DCA_CORE_BSF) += dca_core_bsf.o
OBJS-$(CONFIG_DV_ERROR_MARKER_BSF) += dv_error_marker_bsf.o
OBJS-$(CONFIG_EAC3_CORE_BSF) += eac3_core_bsf.o
OBJS-$(CONFIG_EXTRACT_EXTRADATA_BSF) += extract_extradata_bsf.o \
av1_parse.o h2645_parse.o
@ -1160,14 +1197,15 @@ OBJS-$(CONFIG_MJPEGA_DUMP_HEADER_BSF) += mjpega_dump_header_bsf.o
OBJS-$(CONFIG_MPEG4_UNPACK_BFRAMES_BSF) += mpeg4_unpack_bframes_bsf.o
OBJS-$(CONFIG_MOV2TEXTSUB_BSF) += movsub_bsf.o
OBJS-$(CONFIG_MP3_HEADER_DECOMPRESS_BSF) += mp3_header_decompress_bsf.o \
mpegaudiodata.o
mpegaudiotabs.o
OBJS-$(CONFIG_MPEG2_METADATA_BSF) += mpeg2_metadata_bsf.o
OBJS-$(CONFIG_NOISE_BSF) += noise_bsf.o
OBJS-$(CONFIG_NULL_BSF) += null_bsf.o
OBJS-$(CONFIG_OPUS_METADATA_BSF) += opus_metadata_bsf.o
OBJS-$(CONFIG_PCM_RECHUNK_BSF) += pcm_rechunk_bsf.o
OBJS-$(CONFIG_PGS_FRAME_MERGE_BSF) += pgs_frame_merge_bsf.o
OBJS-$(CONFIG_PRORES_METADATA_BSF) += prores_metadata_bsf.o
OBJS-$(CONFIG_REMOVE_EXTRADATA_BSF) += remove_extradata_bsf.o
OBJS-$(CONFIG_REMOVE_EXTRADATA_BSF) += remove_extradata_bsf.o av1_parse.o
OBJS-$(CONFIG_SETTS_BSF) += setts_bsf.o
OBJS-$(CONFIG_TEXT2MOVSUB_BSF) += movsub_bsf.o
OBJS-$(CONFIG_TRACE_HEADERS_BSF) += trace_headers_bsf.o
@ -1188,7 +1226,6 @@ SLIBOBJS-$(HAVE_GNU_WINDRES) += avcodecres.o
SKIPHEADERS += %_tablegen.h \
%_tables.h \
fft-internal.h \
tableprint.h \
tableprint_vlc.h \
aaccoder_twoloop.h \
@ -1201,6 +1238,7 @@ SKIPHEADERS-$(CONFIG_AMF) += amfenc.h
SKIPHEADERS-$(CONFIG_D3D11VA) += d3d11va.h dxva2_internal.h
SKIPHEADERS-$(CONFIG_DXVA2) += dxva2.h dxva2_internal.h
SKIPHEADERS-$(CONFIG_JNI) += ffjni.h
SKIPHEADERS-$(CONFIG_LIBJXL) += libjxl.h
SKIPHEADERS-$(CONFIG_LIBVPX) += libvpx.h
SKIPHEADERS-$(CONFIG_LIBWEBP_ENCODER) += libwebpenc_common.h
SKIPHEADERS-$(CONFIG_MEDIACODEC) += mediacodecdec_common.h mediacodec_surface.h mediacodec_wrapper.h mediacodec_sw_buffer.h
@ -1215,14 +1253,13 @@ SKIPHEADERS-$(CONFIG_VDPAU) += vdpau.h vdpau_internal.h
SKIPHEADERS-$(CONFIG_VIDEOTOOLBOX) += videotoolbox.h vt_internal.h
SKIPHEADERS-$(CONFIG_V4L2_M2M) += v4l2_buffers.h v4l2_context.h v4l2_m2m.h
TESTPROGS = avpacket \
TESTPROGS = avcodec \
avpacket \
celp_math \
codec_desc \
htmlsubtitles \
imgconvert \
jpeg2000dwt \
mathops \
utils \
TESTPROGS-$(CONFIG_CABAC) += cabac
TESTPROGS-$(CONFIG_DCT) += avfft

View File

@ -24,10 +24,13 @@
* a64 video encoder - multicolor modes
*/
#include "config_components.h"
#include "a64colors.h"
#include "a64tables.h"
#include "codec_internal.h"
#include "elbg.h"
#include "internal.h"
#include "encode.h"
#include "libavutil/avassert.h"
#include "libavutil/common.h"
#include "libavutil/intreadwrite.h"
@ -42,6 +45,7 @@
typedef struct A64Context {
/* variables for multicolor modes */
struct ELBGContext *elbg;
AVLFG randctx;
int mc_lifetime;
int mc_use_5col;
@ -50,7 +54,6 @@ typedef struct A64Context {
int *mc_charmap;
int *mc_best_cb;
int mc_luma_vals[5];
uint8_t *mc_charset;
uint8_t *mc_colram;
uint8_t *mc_palette;
int mc_pal_size;
@ -195,9 +198,11 @@ static void render_charset(AVCodecContext *avctx, uint8_t *charset,
static av_cold int a64multi_close_encoder(AVCodecContext *avctx)
{
A64Context *c = avctx->priv_data;
avpriv_elbg_free(&c->elbg);
av_freep(&c->mc_meta_charset);
av_freep(&c->mc_best_cb);
av_freep(&c->mc_charset);
av_freep(&c->mc_charmap);
av_freep(&c->mc_colram);
return 0;
@ -212,7 +217,7 @@ static av_cold int a64multi_encode_init(AVCodecContext *avctx)
if (avctx->global_quality < 1) {
c->mc_lifetime = 4;
} else {
c->mc_lifetime = avctx->global_quality /= FF_QP2LAMBDA;
c->mc_lifetime = avctx->global_quality / FF_QP2LAMBDA;
}
av_log(avctx, AV_LOG_INFO, "charset lifetime set to %d frame(s)\n", c->mc_lifetime);
@ -228,11 +233,10 @@ static av_cold int a64multi_encode_init(AVCodecContext *avctx)
a64_palette[mc_colors[a]][2] * 0.11;
}
if (!(c->mc_meta_charset = av_mallocz_array(c->mc_lifetime, 32000 * sizeof(int))) ||
if (!(c->mc_meta_charset = av_calloc(c->mc_lifetime, 32000 * sizeof(int))) ||
!(c->mc_best_cb = av_malloc(CHARSET_CHARS * 32 * sizeof(int))) ||
!(c->mc_charmap = av_mallocz_array(c->mc_lifetime, 1000 * sizeof(int))) ||
!(c->mc_colram = av_mallocz(CHARSET_CHARS * sizeof(uint8_t))) ||
!(c->mc_charset = av_malloc(0x800 * (INTERLACED+1) * sizeof(uint8_t)))) {
!(c->mc_charmap = av_calloc(c->mc_lifetime, 1000 * sizeof(int))) ||
!(c->mc_colram = av_mallocz(CHARSET_CHARS * sizeof(uint8_t)))) {
av_log(avctx, AV_LOG_ERROR, "Failed to allocate buffer memory.\n");
return AVERROR(ENOMEM);
}
@ -284,7 +288,6 @@ static int a64multi_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
int *charmap = c->mc_charmap;
uint8_t *colram = c->mc_colram;
uint8_t *charset = c->mc_charset;
int *meta = c->mc_meta_charset;
int *best_cb = c->mc_best_cb;
@ -331,25 +334,18 @@ static int a64multi_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
/* any frames to encode? */
if (c->mc_lifetime) {
int alloc_size = charset_size + c->mc_lifetime*(screen_size + colram_size);
if ((ret = ff_alloc_packet2(avctx, pkt, alloc_size, 0)) < 0)
if ((ret = ff_get_encode_buffer(avctx, pkt, alloc_size, 0)) < 0)
return ret;
buf = pkt->data;
/* calc optimal new charset + charmaps */
ret = avpriv_init_elbg(meta, 32, 1000 * c->mc_lifetime, best_cb,
CHARSET_CHARS, 50, charmap, &c->randctx);
if (ret < 0)
return ret;
ret = avpriv_do_elbg(meta, 32, 1000 * c->mc_lifetime, best_cb,
CHARSET_CHARS, 50, charmap, &c->randctx);
ret = avpriv_elbg_do(&c->elbg, meta, 32, 1000 * c->mc_lifetime,
best_cb, CHARSET_CHARS, 50, charmap, &c->randctx, 0);
if (ret < 0)
return ret;
/* create colorram map and a c64 readable charset */
render_charset(avctx, charset, colram);
/* copy charset to buf */
memcpy(buf, charset, charset_size);
render_charset(avctx, buf, colram);
/* advance pointers */
buf += charset_size;
@ -390,41 +386,39 @@ static int a64multi_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
pkt->pts = pkt->dts = c->next_pts;
c->next_pts = AV_NOPTS_VALUE;
av_assert0(pkt->size >= req_size);
pkt->size = req_size;
pkt->flags |= AV_PKT_FLAG_KEY;
av_assert0(pkt->size == req_size);
*got_packet = !!req_size;
}
return 0;
}
#if CONFIG_A64MULTI_ENCODER
AVCodec ff_a64multi_encoder = {
.name = "a64multi",
.long_name = NULL_IF_CONFIG_SMALL("Multicolor charset for Commodore 64"),
.type = AVMEDIA_TYPE_VIDEO,
.id = AV_CODEC_ID_A64_MULTI,
const FFCodec ff_a64multi_encoder = {
.p.name = "a64multi",
.p.long_name = NULL_IF_CONFIG_SMALL("Multicolor charset for Commodore 64"),
.p.type = AVMEDIA_TYPE_VIDEO,
.p.id = AV_CODEC_ID_A64_MULTI,
.p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY,
.priv_data_size = sizeof(A64Context),
.init = a64multi_encode_init,
.encode2 = a64multi_encode_frame,
FF_CODEC_ENCODE_CB(a64multi_encode_frame),
.close = a64multi_close_encoder,
.pix_fmts = (const enum AVPixelFormat[]) {AV_PIX_FMT_GRAY8, AV_PIX_FMT_NONE},
.capabilities = AV_CODEC_CAP_DELAY,
.p.pix_fmts = (const enum AVPixelFormat[]) {AV_PIX_FMT_GRAY8, AV_PIX_FMT_NONE},
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP | FF_CODEC_CAP_INIT_THREADSAFE,
};
#endif
#if CONFIG_A64MULTI5_ENCODER
AVCodec ff_a64multi5_encoder = {
.name = "a64multi5",
.long_name = NULL_IF_CONFIG_SMALL("Multicolor charset for Commodore 64, extended with 5th color (colram)"),
.type = AVMEDIA_TYPE_VIDEO,
.id = AV_CODEC_ID_A64_MULTI5,
const FFCodec ff_a64multi5_encoder = {
.p.name = "a64multi5",
.p.long_name = NULL_IF_CONFIG_SMALL("Multicolor charset for Commodore 64, extended with 5th color (colram)"),
.p.type = AVMEDIA_TYPE_VIDEO,
.p.id = AV_CODEC_ID_A64_MULTI5,
.p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY,
.priv_data_size = sizeof(A64Context),
.init = a64multi_encode_init,
.encode2 = a64multi_encode_frame,
FF_CODEC_ENCODE_CB(a64multi_encode_frame),
.close = a64multi_close_encoder,
.pix_fmts = (const enum AVPixelFormat[]) {AV_PIX_FMT_GRAY8, AV_PIX_FMT_NONE},
.capabilities = AV_CODEC_CAP_DELAY,
.p.pix_fmts = (const enum AVPixelFormat[]) {AV_PIX_FMT_GRAY8, AV_PIX_FMT_NONE},
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP | FF_CODEC_CAP_INIT_THREADSAFE,
};
#endif

View File

@ -32,6 +32,7 @@
#include "aac_defines.h"
#include "libavutil/channel_layout.h"
#include "libavutil/float_dsp.h"
#include "libavutil/fixed_dsp.h"
#include "libavutil/mem_internal.h"
@ -125,8 +126,7 @@ typedef struct OutputConfiguration {
MPEG4AudioConfig m4ac;
uint8_t layout_map[MAX_ELEM_ID*4][3];
int layout_map_tags;
int channels;
uint64_t channel_layout;
AVChannelLayout ch_layout;
enum OCStatus status;
} OutputConfiguration;
@ -288,6 +288,11 @@ typedef struct ChannelElement {
SpectralBandReplication sbr;
} ChannelElement;
enum AACOutputChannelOrder {
CHANNEL_ORDER_DEFAULT,
CHANNEL_ORDER_CODED,
};
/**
* main AAC context
*/
@ -352,6 +357,8 @@ struct AACContext {
int dmono_mode; ///< 0->not dmono, 1->use first channel, 2->use second channel
/** @} */
enum AACOutputChannelOrder output_channel_order;
DECLARE_ALIGNED(32, INTFLOAT, temp)[128];
OutputConfiguration oc[2];

View File

@ -20,6 +20,8 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "config_components.h"
#include "libavutil/channel_layout.h"
#include "libavutil/common.h"
#include "parser.h"
@ -90,8 +92,19 @@ get_next:
if (avctx->codec_id != AV_CODEC_ID_AAC) {
avctx->sample_rate = s->sample_rate;
if (!CONFIG_EAC3_DECODER || avctx->codec_id != AV_CODEC_ID_EAC3) {
avctx->channels = s->channels;
av_channel_layout_uninit(&avctx->ch_layout);
if (s->channel_layout) {
av_channel_layout_from_mask(&avctx->ch_layout, s->channel_layout);
} else {
avctx->ch_layout.order = AV_CHANNEL_ORDER_UNSPEC;
avctx->ch_layout.nb_channels = s->channels;
}
#if FF_API_OLD_CHANNEL_LAYOUT
FF_DISABLE_DEPRECATION_WARNINGS
avctx->channels = avctx->ch_layout.nb_channels;
avctx->channel_layout = s->channel_layout;
FF_ENABLE_DEPRECATION_WARNINGS
#endif
}
s1->duration = s->samples;
avctx->audio_service_type = s->service_type;

View File

@ -26,7 +26,6 @@
#include "put_bits.h"
#include "get_bits.h"
#include "mpeg4audio.h"
#include "internal.h"
typedef struct AACBSFContext {
int first_frame_done;
@ -149,10 +148,10 @@ static const enum AVCodecID codec_ids[] = {
AV_CODEC_ID_AAC, AV_CODEC_ID_NONE,
};
const AVBitStreamFilter ff_aac_adtstoasc_bsf = {
.name = "aac_adtstoasc",
const FFBitStreamFilter ff_aac_adtstoasc_bsf = {
.p.name = "aac_adtstoasc",
.p.codec_ids = codec_ids,
.priv_data_size = sizeof(AACBSFContext),
.init = aac_adtstoasc_init,
.filter = aac_adtstoasc_filter,
.codec_ids = codec_ids,
};

View File

@ -30,7 +30,6 @@
#include "libavutil/softfloat.h"
#define FFT_FLOAT 0
#define FFT_FIXED_32 1
#define AAC_RENAME(x) x ## _fixed
#define AAC_RENAME_32(x) x ## _fixed_32
@ -80,7 +79,6 @@ typedef int AAC_SIGNE;
#else
#define FFT_FLOAT 1
#define FFT_FIXED_32 0
#define AAC_RENAME(x) x
#define AAC_RENAME_32(x) x

View File

@ -62,7 +62,7 @@ static av_cold int aac_parse_init(AVCodecParserContext *s1)
}
AVCodecParser ff_aac_parser = {
const AVCodecParser ff_aac_parser = {
.codec_ids = { AV_CODEC_ID_AAC },
.priv_data_size = sizeof(AACAC3ParseContext),
.parser_init = aac_parse_init,

View File

@ -397,7 +397,7 @@ static void search_for_quantizers_fast(AVCodecContext *avctx, AACEncContext *s,
const float lambda)
{
int start = 0, i, w, w2, g;
int destbits = avctx->bit_rate * 1024.0 / avctx->sample_rate / avctx->channels * (lambda / 120.f);
int destbits = avctx->bit_rate * 1024.0 / avctx->sample_rate / avctx->ch_layout.nb_channels * (lambda / 120.f);
float dists[128] = { 0 }, uplims[128] = { 0 };
float maxvals[128];
int fflag, minscaler;
@ -414,11 +414,10 @@ static void search_for_quantizers_fast(AVCodecContext *avctx, AACEncContext *s,
start = 0;
for (g = 0; g < sce->ics.num_swb; g++) {
int nz = 0;
float uplim = 0.0f, energy = 0.0f;
float uplim = 0.0f;
for (w2 = 0; w2 < sce->ics.group_len[w]; w2++) {
FFPsyBand *band = &s->psy.ch[s->cur_channel].psy_bands[(w+w2)*16+g];
uplim += band->threshold;
energy += band->energy;
if (band->energy <= band->threshold || band->threshold == 0.0f) {
sce->zeroes[(w+w2)*16+g] = 1;
continue;
@ -557,7 +556,7 @@ static void search_for_pns(AACEncContext *s, AVCodecContext *avctx, SingleChanne
const float pns_transient_energy_r = FFMIN(0.7f, lambda / 140.f);
int refbits = avctx->bit_rate * 1024.0 / avctx->sample_rate
/ ((avctx->flags & AV_CODEC_FLAG_QSCALE) ? 2.0f : avctx->channels)
/ ((avctx->flags & AV_CODEC_FLAG_QSCALE) ? 2.0f : avctx->ch_layout.nb_channels)
* (lambda / 120.f);
/** Keep this in sync with twoloop's cutoff selection */
@ -565,7 +564,7 @@ static void search_for_pns(AACEncContext *s, AVCodecContext *avctx, SingleChanne
int prev = -1000, prev_sf = -1;
int frame_bit_rate = (avctx->flags & AV_CODEC_FLAG_QSCALE)
? (refbits * rate_bandwidth_multiplier * avctx->sample_rate / 1024)
: (avctx->bit_rate / avctx->channels);
: (avctx->bit_rate / avctx->ch_layout.nb_channels);
frame_bit_rate *= 1.15f;
@ -694,14 +693,14 @@ static void mark_pns(AACEncContext *s, AVCodecContext *avctx, SingleChannelEleme
const float pns_transient_energy_r = FFMIN(0.7f, lambda / 140.f);
int refbits = avctx->bit_rate * 1024.0 / avctx->sample_rate
/ ((avctx->flags & AV_CODEC_FLAG_QSCALE) ? 2.0f : avctx->channels)
/ ((avctx->flags & AV_CODEC_FLAG_QSCALE) ? 2.0f : avctx->ch_layout.nb_channels)
* (lambda / 120.f);
/** Keep this in sync with twoloop's cutoff selection */
float rate_bandwidth_multiplier = 1.5f;
int frame_bit_rate = (avctx->flags & AV_CODEC_FLAG_QSCALE)
? (refbits * rate_bandwidth_multiplier * avctx->sample_rate / 1024)
: (avctx->bit_rate / avctx->channels);
: (avctx->bit_rate / avctx->ch_layout.nb_channels);
frame_bit_rate *= 1.15f;

View File

@ -71,7 +71,7 @@ static void search_for_quantizers_twoloop(AVCodecContext *avctx,
{
int start = 0, i, w, w2, g, recomprd;
int destbits = avctx->bit_rate * 1024.0 / avctx->sample_rate
/ ((avctx->flags & AV_CODEC_FLAG_QSCALE) ? 2.0f : avctx->channels)
/ ((avctx->flags & AV_CODEC_FLAG_QSCALE) ? 2.0f : avctx->ch_layout.nb_channels)
* (lambda / 120.f);
int refbits = destbits;
int toomanybits, toofewbits;
@ -186,7 +186,7 @@ static void search_for_quantizers_twoloop(AVCodecContext *avctx,
float rate_bandwidth_multiplier = 1.5f;
int frame_bit_rate = (avctx->flags & AV_CODEC_FLAG_QSCALE)
? (refbits * rate_bandwidth_multiplier * avctx->sample_rate / 1024)
: (avctx->bit_rate / avctx->channels);
: (avctx->bit_rate / avctx->ch_layout.nb_channels);
/** Compensate for extensions that increase efficiency */
if (s->options.pns || s->options.intensity_stereo)

View File

@ -33,13 +33,12 @@
*/
#define FFT_FLOAT 1
#define FFT_FIXED_32 0
#define USE_FIXED 0
#include "libavutil/float_dsp.h"
#include "libavutil/opt.h"
#include "avcodec.h"
#include "internal.h"
#include "codec_internal.h"
#include "get_bits.h"
#include "fft.h"
#include "mdct15.h"
@ -481,7 +480,7 @@ static int read_audio_mux_element(struct LATMContext *latmctx,
}
static int latm_decode_frame(AVCodecContext *avctx, void *out,
static int latm_decode_frame(AVCodecContext *avctx, AVFrame *out,
int *got_frame_ptr, AVPacket *avpkt)
{
struct LATMContext *latmctx = avctx->priv_data;
@ -553,24 +552,27 @@ static av_cold int latm_decode_init(AVCodecContext *avctx)
return ret;
}
AVCodec ff_aac_decoder = {
.name = "aac",
.long_name = NULL_IF_CONFIG_SMALL("AAC (Advanced Audio Coding)"),
.type = AVMEDIA_TYPE_AUDIO,
.id = AV_CODEC_ID_AAC,
const FFCodec ff_aac_decoder = {
.p.name = "aac",
.p.long_name = NULL_IF_CONFIG_SMALL("AAC (Advanced Audio Coding)"),
.p.type = AVMEDIA_TYPE_AUDIO,
.p.id = AV_CODEC_ID_AAC,
.priv_data_size = sizeof(AACContext),
.init = aac_decode_init,
.close = aac_decode_close,
.decode = aac_decode_frame,
.sample_fmts = (const enum AVSampleFormat[]) {
FF_CODEC_DECODE_CB(aac_decode_frame),
.p.sample_fmts = (const enum AVSampleFormat[]) {
AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_NONE
},
.capabilities = AV_CODEC_CAP_CHANNEL_CONF | AV_CODEC_CAP_DR1,
.p.capabilities = AV_CODEC_CAP_CHANNEL_CONF | AV_CODEC_CAP_DR1,
.caps_internal = FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_INIT_CLEANUP,
.channel_layouts = aac_channel_layout,
#if FF_API_OLD_CHANNEL_LAYOUT
.p.channel_layouts = aac_channel_layout,
#endif
.p.ch_layouts = aac_ch_layout,
.flush = flush,
.priv_class = &aac_decoder_class,
.profiles = NULL_IF_CONFIG_SMALL(ff_aac_profiles),
.p.priv_class = &aac_decoder_class,
.p.profiles = NULL_IF_CONFIG_SMALL(ff_aac_profiles),
};
/*
@ -578,21 +580,24 @@ AVCodec ff_aac_decoder = {
in MPEG transport streams which only contain one program.
To do a more complex LATM demuxing a separate LATM demuxer should be used.
*/
AVCodec ff_aac_latm_decoder = {
.name = "aac_latm",
.long_name = NULL_IF_CONFIG_SMALL("AAC LATM (Advanced Audio Coding LATM syntax)"),
.type = AVMEDIA_TYPE_AUDIO,
.id = AV_CODEC_ID_AAC_LATM,
const FFCodec ff_aac_latm_decoder = {
.p.name = "aac_latm",
.p.long_name = NULL_IF_CONFIG_SMALL("AAC LATM (Advanced Audio Coding LATM syntax)"),
.p.type = AVMEDIA_TYPE_AUDIO,
.p.id = AV_CODEC_ID_AAC_LATM,
.priv_data_size = sizeof(struct LATMContext),
.init = latm_decode_init,
.close = aac_decode_close,
.decode = latm_decode_frame,
.sample_fmts = (const enum AVSampleFormat[]) {
FF_CODEC_DECODE_CB(latm_decode_frame),
.p.sample_fmts = (const enum AVSampleFormat[]) {
AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_NONE
},
.capabilities = AV_CODEC_CAP_CHANNEL_CONF | AV_CODEC_CAP_DR1,
.p.capabilities = AV_CODEC_CAP_CHANNEL_CONF | AV_CODEC_CAP_DR1,
.caps_internal = FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_INIT_CLEANUP,
.channel_layouts = aac_channel_layout,
#if FF_API_OLD_CHANNEL_LAYOUT
.p.channel_layouts = aac_channel_layout,
#endif
.p.ch_layouts = aac_ch_layout,
.flush = flush,
.profiles = NULL_IF_CONFIG_SMALL(ff_aac_profiles),
.p.profiles = NULL_IF_CONFIG_SMALL(ff_aac_profiles),
};

View File

@ -59,13 +59,12 @@
*/
#define FFT_FLOAT 0
#define FFT_FIXED_32 1
#define USE_FIXED 1
#include "libavutil/fixed_dsp.h"
#include "libavutil/opt.h"
#include "avcodec.h"
#include "internal.h"
#include "codec_internal.h"
#include "get_bits.h"
#include "fft.h"
#include "lpc.h"
@ -451,21 +450,24 @@ static void apply_independent_coupling_fixed(AACContext *ac,
#include "aacdec_template.c"
AVCodec ff_aac_fixed_decoder = {
.name = "aac_fixed",
.long_name = NULL_IF_CONFIG_SMALL("AAC (Advanced Audio Coding)"),
.type = AVMEDIA_TYPE_AUDIO,
.id = AV_CODEC_ID_AAC,
const FFCodec ff_aac_fixed_decoder = {
.p.name = "aac_fixed",
.p.long_name = NULL_IF_CONFIG_SMALL("AAC (Advanced Audio Coding)"),
.p.type = AVMEDIA_TYPE_AUDIO,
.p.id = AV_CODEC_ID_AAC,
.priv_data_size = sizeof(AACContext),
.init = aac_decode_init,
.close = aac_decode_close,
.decode = aac_decode_frame,
.sample_fmts = (const enum AVSampleFormat[]) {
FF_CODEC_DECODE_CB(aac_decode_frame),
.p.sample_fmts = (const enum AVSampleFormat[]) {
AV_SAMPLE_FMT_S32P, AV_SAMPLE_FMT_NONE
},
.capabilities = AV_CODEC_CAP_CHANNEL_CONF | AV_CODEC_CAP_DR1,
.p.capabilities = AV_CODEC_CAP_CHANNEL_CONF | AV_CODEC_CAP_DR1,
.caps_internal = FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_INIT_CLEANUP,
.channel_layouts = aac_channel_layout,
.profiles = NULL_IF_CONFIG_SMALL(ff_aac_profiles),
#if FF_API_OLD_CHANNEL_LAYOUT
.p.channel_layouts = aac_channel_layout,
#endif
.p.ch_layouts = aac_ch_layout,
.p.profiles = NULL_IF_CONFIG_SMALL(ff_aac_profiles),
.flush = flush,
};

Some files were not shown because too many files have changed in this diff Show More