Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c40983a6f6 | ||
|
|
bd0497b28b | ||
|
|
4d95207938 | ||
|
|
1e8a75fae4 | ||
|
|
380980e0d2 | ||
|
|
1fd8eb4d4f |
64
.gitignore
vendored
64
.gitignore
vendored
@@ -18,6 +18,8 @@
|
||||
*.so.*
|
||||
*.swp
|
||||
*.ver
|
||||
*-example
|
||||
*-test
|
||||
*_g
|
||||
\#*
|
||||
.\#*
|
||||
@@ -30,6 +32,66 @@
|
||||
/config.*
|
||||
/coverage.info
|
||||
/avversion.h
|
||||
/doc/*.1
|
||||
/doc/*.3
|
||||
/doc/*.html
|
||||
/doc/*.pod
|
||||
/doc/config.texi
|
||||
/doc/avoptions_codec.texi
|
||||
/doc/avoptions_format.texi
|
||||
/doc/doxy/html/
|
||||
/doc/examples/avio_dir_cmd
|
||||
/doc/examples/avio_reading
|
||||
/doc/examples/decoding_encoding
|
||||
/doc/examples/demuxing_decoding
|
||||
/doc/examples/extract_mvs
|
||||
/doc/examples/filter_audio
|
||||
/doc/examples/filtering_audio
|
||||
/doc/examples/filtering_video
|
||||
/doc/examples/metadata
|
||||
/doc/examples/muxing
|
||||
/doc/examples/pc-uninstalled
|
||||
/doc/examples/remuxing
|
||||
/doc/examples/resampling_audio
|
||||
/doc/examples/scaling_video
|
||||
/doc/examples/transcode_aac
|
||||
/doc/examples/transcoding
|
||||
/doc/fate.txt
|
||||
/doc/print_options
|
||||
/lcov/
|
||||
/libavcodec/*_tablegen
|
||||
/libavcodec/*_tables.c
|
||||
/libavcodec/*_tables.h
|
||||
/libavutil/avconfig.h
|
||||
/libavutil/ffversion.h
|
||||
/src
|
||||
/mapfile
|
||||
/tests/audiogen
|
||||
/tests/base64
|
||||
/tests/checkasm/checkasm
|
||||
/tests/data/
|
||||
/tests/pixfmts.mak
|
||||
/tests/rotozoom
|
||||
/tests/test_copy.ffmeta
|
||||
/tests/tiny_psnr
|
||||
/tests/tiny_ssim
|
||||
/tests/videogen
|
||||
/tests/vsynth1/
|
||||
/tools/aviocat
|
||||
/tools/ffbisect
|
||||
/tools/bisect.need
|
||||
/tools/crypto_bench
|
||||
/tools/cws2fws
|
||||
/tools/fourcc2pixfmt
|
||||
/tools/ffescape
|
||||
/tools/ffeval
|
||||
/tools/ffhash
|
||||
/tools/graph2dot
|
||||
/tools/ismindex
|
||||
/tools/pktdumper
|
||||
/tools/probetest
|
||||
/tools/qt-faststart
|
||||
/tools/sidxindex
|
||||
/tools/trasher
|
||||
/tools/seek_print
|
||||
/tools/uncoded_frame
|
||||
/tools/zmqsend
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
# Note to Github users
|
||||
Patches should be submitted to the [ffmpeg-devel mailing list](https://ffmpeg.org/mailman/listinfo/ffmpeg-devel) using `git format-patch` or `git send-email`. Github pull requests should be avoided because they are not part of our review process and **will be ignored**.
|
||||
|
||||
See [https://ffmpeg.org/developer.html#Contributing](https://ffmpeg.org/developer.html#Contributing) for more information.
|
||||
94
Changelog
94
Changelog
@@ -1,94 +1,6 @@
|
||||
Entries are sorted chronologically from oldest to youngest within each release,
|
||||
releases are sorted from youngest to oldest.
|
||||
|
||||
version <next>:
|
||||
|
||||
version 3.2:
|
||||
- libopenmpt demuxer
|
||||
- tee protocol
|
||||
- Changed metadata print option to accept general urls
|
||||
- Alias muxer for Ogg Video (.ogv)
|
||||
- VP8 in Ogg muxing
|
||||
- curves filter doesn't automatically insert points at x=0 and x=1 anymore
|
||||
- 16-bit support in curves filter and selectivecolor filter
|
||||
- OpenH264 decoder wrapper
|
||||
- MediaCodec H.264/HEVC/MPEG-4/VP8/VP9 hwaccel
|
||||
- True Audio (TTA) muxer
|
||||
- crystalizer audio filter
|
||||
- acrusher audio filter
|
||||
- bitplanenoise video filter
|
||||
- floating point support in als decoder
|
||||
- fifo muxer
|
||||
- maskedclamp filter
|
||||
- hysteresis filter
|
||||
- lut2 filter
|
||||
- yuvtestsrc filter
|
||||
- CUDA CUVID H.263/VP8/VP9/10 bit HEVC (Dithered) Decoding
|
||||
- vaguedenoiser filter
|
||||
- added threads option per filter instance
|
||||
- weave filter
|
||||
- gblur filter
|
||||
- avgblur filter
|
||||
- sobel and prewitt filter
|
||||
- MediaCodec HEVC/MPEG-4/VP8/VP9 decoding
|
||||
- Meridian Lossless Packing (MLP) / TrueHD encoder
|
||||
- Non-Local Means (nlmeans) denoising filter
|
||||
- sdl2 output device and ffplay support
|
||||
- sdl1 output device and sdl1 support removed
|
||||
- extended mov edit list support
|
||||
- libfaac encoder removed
|
||||
- Matroska muxer now writes CRC32 elements by default in all Level 1 elements
|
||||
- sidedata video and asidedata audio filter
|
||||
- Changed mapping of rtp MIME type G726 to codec g726le.
|
||||
|
||||
|
||||
version 3.1:
|
||||
- DXVA2-accelerated HEVC Main10 decoding
|
||||
- fieldhint filter
|
||||
- loop video filter and aloop audio filter
|
||||
- Bob Weaver deinterlacing filter
|
||||
- firequalizer filter
|
||||
- datascope filter
|
||||
- bench and abench filters
|
||||
- ciescope filter
|
||||
- protocol blacklisting API
|
||||
- MediaCodec H264 decoding
|
||||
- VC-2 HQ RTP payload format (draft v1) depacketizer and packetizer
|
||||
- VP9 RTP payload format (draft v2) packetizer
|
||||
- AudioToolbox audio decoders
|
||||
- AudioToolbox audio encoders
|
||||
- coreimage filter (GPU based image filtering on OSX)
|
||||
- libdcadec removed
|
||||
- bitstream filter for extracting DTS core
|
||||
- ADPCM IMA DAT4 decoder
|
||||
- musx demuxer
|
||||
- aix demuxer
|
||||
- remap filter
|
||||
- hash and framehash muxers
|
||||
- colorspace filter
|
||||
- hdcd filter
|
||||
- readvitc filter
|
||||
- VAAPI-accelerated format conversion and scaling
|
||||
- libnpp/CUDA-accelerated format conversion and scaling
|
||||
- Duck TrueMotion 2.0 Real Time decoder
|
||||
- Wideband Single-bit Data (WSD) demuxer
|
||||
- VAAPI-accelerated H.264/HEVC/MJPEG encoding
|
||||
- DTS Express (LBR) decoder
|
||||
- Generic OpenMAX IL encoder with support for Raspberry Pi
|
||||
- IFF ANIM demuxer & decoder
|
||||
- Direct Stream Transfer (DST) decoder
|
||||
- loudnorm filter
|
||||
- MTAF demuxer and decoder
|
||||
- MagicYUV decoder
|
||||
- OpenExr improvements (tile data and B44/B44A support)
|
||||
- BitJazz SheerVideo decoder
|
||||
- CUDA CUVID H264/HEVC decoder
|
||||
- 10-bit depth support in native utvideo decoder
|
||||
- libutvideo wrapper removed
|
||||
- YUY2 Lossless Codec decoder
|
||||
- VideoToolbox H.264 encoder
|
||||
|
||||
|
||||
version 3.0:
|
||||
- Common Encryption (CENC) MP4 encoding and decoding support
|
||||
- DXV decoding
|
||||
@@ -959,8 +871,8 @@ version 0.8:
|
||||
- showinfo filter added
|
||||
- SMPTE 302M AES3 audio decoder
|
||||
- Apple Core Audio Format muxer
|
||||
- 9 bits and 10 bits per sample support in the H.264 decoder
|
||||
- 9 bits and 10 bits FFV1 encoding / decoding
|
||||
- 9bit and 10bit per sample support in the H.264 decoder
|
||||
- 9bit and 10bit FFV1 encoding / decoding
|
||||
- split filter added
|
||||
- select filter added
|
||||
- sdl output device added
|
||||
@@ -1253,7 +1165,7 @@ version 0.4.9-pre1:
|
||||
- rate distorted optimal lambda->qp support
|
||||
- AAC encoding with libfaac
|
||||
- Sunplus JPEG codec (SP5X) support
|
||||
- use Lagrange multiplier instead of QP for ratecontrol
|
||||
- use Lagrange multipler instead of QP for ratecontrol
|
||||
- Theora/VP3 decoding support
|
||||
- XA and ADX ADPCM codecs
|
||||
- export MPEG-2 active display area / pan scan
|
||||
|
||||
60
LICENSE.md
60
LICENSE.md
@@ -1,4 +1,4 @@
|
||||
# License
|
||||
#FFmpeg:
|
||||
|
||||
Most files in FFmpeg are under the GNU Lesser General Public License version 2.1
|
||||
or later (LGPL v2.1+). Read the file `COPYING.LGPLv2.1` for details. Some other
|
||||
@@ -13,18 +13,16 @@ configure to activate them. In this case, FFmpeg's license changes to GPL v2+.
|
||||
Specifically, the GPL parts of FFmpeg are:
|
||||
|
||||
- libpostproc
|
||||
- optional x86 optimization in the files
|
||||
- `libavcodec/x86/flac_dsp_gpl.asm`
|
||||
- `libavcodec/x86/idct_mmx.c`
|
||||
- `libavfilter/x86/vf_removegrain.asm`
|
||||
- optional x86 optimizations in the files
|
||||
- `libavcodec/x86/flac_dsp_gpl.asm`
|
||||
- `libavcodec/x86/idct_mmx.c`
|
||||
- `libavfilter/x86/vf_removegrain.asm`
|
||||
- libutvideo encoding/decoding wrappers in
|
||||
`libavcodec/libutvideo*.cpp`
|
||||
- the X11 grabber in `libavdevice/x11grab.c`
|
||||
- the following building and testing tools
|
||||
- `compat/solaris/make_sunver.pl`
|
||||
- `doc/t2h.pm`
|
||||
- `doc/texi2pod.pl`
|
||||
- `libswresample/swresample-test.c`
|
||||
- `tests/checkasm/*`
|
||||
- `tests/tiny_ssim.c`
|
||||
- the swresample test app in
|
||||
`libswresample/swresample-test.c`
|
||||
- the `texi2pod.pl` tool
|
||||
- the following filters in libavfilter:
|
||||
- `f_ebur128.c`
|
||||
- `vf_blackframe.c`
|
||||
@@ -49,9 +47,9 @@ Specifically, the GPL parts of FFmpeg are:
|
||||
- `vf_pp.c`
|
||||
- `vf_pp7.c`
|
||||
- `vf_pullup.c`
|
||||
- `vf_repeatfields.c`
|
||||
- `vf_sab.c`
|
||||
- `vf_smartblur.c`
|
||||
- `vf_repeatfields.c`
|
||||
- `vf_spp.c`
|
||||
- `vf_stereo3d.c`
|
||||
- `vf_super2xsai.c`
|
||||
@@ -75,17 +73,20 @@ There are a handful of files under other licensing terms, namely:
|
||||
* `tests/reference.pnm` is under the expat license.
|
||||
|
||||
|
||||
## External libraries
|
||||
external libraries
|
||||
==================
|
||||
|
||||
FFmpeg can be combined with a number of external libraries, which sometimes
|
||||
affect the licensing of binaries resulting from the combination.
|
||||
|
||||
### Compatible libraries
|
||||
compatible libraries
|
||||
--------------------
|
||||
|
||||
The following libraries are under GPL:
|
||||
- frei0r
|
||||
- libcdio
|
||||
- librubberband
|
||||
- libutvideo
|
||||
- libvidstab
|
||||
- libx264
|
||||
- libx265
|
||||
@@ -100,23 +101,14 @@ license is incompatible with the LGPL v2.1 and the GPL v2, but not with
|
||||
version 3 of those licenses. So to combine these libraries with FFmpeg, the
|
||||
license version needs to be upgraded by passing `--enable-version3` to configure.
|
||||
|
||||
### Incompatible libraries
|
||||
incompatible libraries
|
||||
----------------------
|
||||
|
||||
There are certain libraries you can combine with FFmpeg whose licenses are not
|
||||
compatible with the GPL and/or the LGPL. If you wish to enable these
|
||||
libraries, even in circumstances that their license may be incompatible, pass
|
||||
`--enable-nonfree` to configure. But note that if you enable any of these
|
||||
libraries the resulting binary will be under a complex license mix that is
|
||||
more restrictive than the LGPL and that may result in additional obligations.
|
||||
It is possible that these restrictions cause the resulting binary to be
|
||||
unredistributable.
|
||||
|
||||
The Fraunhofer FDK AAC and OpenSSL libraries are under licenses which are
|
||||
incompatible with the GPLv2 and v3. To the best of our knowledge, they are
|
||||
compatible with the LGPL.
|
||||
|
||||
The NVENC library, while its header file is licensed under the compatible MIT
|
||||
license, requires a proprietary binary blob at run time, and is deemed to be
|
||||
incompatible with the GPL. We are not certain if it is compatible with the
|
||||
LGPL, but we require `--enable-nonfree` even with LGPL configurations in case
|
||||
it is not.
|
||||
The Fraunhofer AAC library and FAAC are under licenses which
|
||||
are incompatible with the GPLv2 and v3. We do not know for certain if their
|
||||
licenses are compatible with the LGPL.
|
||||
If you wish to enable these libraries, pass `--enable-nonfree` to configure.
|
||||
But note that if you enable any of these libraries the resulting binary will
|
||||
be under a complex license mix that is more restrictive than the LGPL and that
|
||||
may result in additional obligations. It is possible that these
|
||||
restrictions cause the resulting binary to be unredistributeable.
|
||||
|
||||
133
MAINTAINERS
133
MAINTAINERS
@@ -43,7 +43,8 @@ Miscellaneous Areas
|
||||
===================
|
||||
|
||||
documentation Stefano Sabatini, Mike Melanson, Timothy Gu, Lou Logan
|
||||
project server Árpád Gereöffy, Michael Niedermayer, Reimar Doeffinger, Alexander Strasser, Nikolay Aleksandrov
|
||||
build system (configure, makefiles) Diego Biurrun, Mans Rullgard
|
||||
project server Árpád Gereöffy, Michael Niedermayer, Reimar Doeffinger, Alexander Strasser, Lou Logan
|
||||
presets Robert Swain
|
||||
metadata subsystem Aurelien Jacobs
|
||||
release management Michael Niedermayer
|
||||
@@ -55,7 +56,7 @@ Communication
|
||||
website Deby Barbara Lepage
|
||||
fate.ffmpeg.org Timothy Gu
|
||||
Trac bug tracker Alexander Strasser, Michael Niedermayer, Carl Eugen Hoyos, Lou Logan
|
||||
mailing lists Baptiste Coudurier, Lou Logan
|
||||
mailing lists Michael Niedermayer, Baptiste Coudurier, Lou Logan
|
||||
Google+ Paul B Mahol, Michael Niedermayer, Alexander Strasser
|
||||
Twitter Lou Logan, Reynaldo H. Verdejo Pinochet
|
||||
Launchpad Timothy Gu
|
||||
@@ -78,7 +79,6 @@ Other:
|
||||
eval.c, eval.h Michael Niedermayer
|
||||
float_dsp Loren Merritt
|
||||
hash Reimar Doeffinger
|
||||
hwcontext_cuda* Timo Rothenpieler
|
||||
intfloat* Michael Niedermayer
|
||||
integer.c, integer.h Michael Niedermayer
|
||||
lzo Reimar Doeffinger
|
||||
@@ -89,6 +89,7 @@ Other:
|
||||
rational.c, rational.h Michael Niedermayer
|
||||
rc4 Reimar Doeffinger
|
||||
ripemd.c, ripemd.h James Almer
|
||||
timecode Clément Bœsch
|
||||
|
||||
|
||||
libavcodec
|
||||
@@ -116,6 +117,8 @@ Generic Parts:
|
||||
faandct.c, faandct.h Michael Niedermayer
|
||||
Golomb coding:
|
||||
golomb.c, golomb.h Michael Niedermayer
|
||||
LPC:
|
||||
lpc.c, lpc.h Justin Ruggles
|
||||
motion estimation:
|
||||
motion* Michael Niedermayer
|
||||
rate control:
|
||||
@@ -136,37 +139,47 @@ Codecs:
|
||||
8bps.c Roberto Togni
|
||||
8svx.c Jaikrishnan Menon
|
||||
aacenc*, aaccoder.c Rostislav Pehlivanov
|
||||
aasc.c Kostya Shishkov
|
||||
ac3* Justin Ruggles
|
||||
alacenc.c Jaikrishnan Menon
|
||||
alsdec.c Thilo Borgmann, Umair Khan
|
||||
alsdec.c Thilo Borgmann
|
||||
apedec.c Kostya Shishkov
|
||||
ass* Aurelien Jacobs
|
||||
asv* Michael Niedermayer
|
||||
atrac3* Benjamin Larsson
|
||||
atrac3plus* Maxim Poliakovski
|
||||
audiotoolbox* Rodger Combs
|
||||
bgmc.c, bgmc.h Thilo Borgmann
|
||||
bink.c Kostya Shishkov
|
||||
binkaudio.c Peter Ross
|
||||
bmp.c Mans Rullgard, Kostya Shishkov
|
||||
cavs* Stefan Gehrer
|
||||
cdxl.c Paul B Mahol
|
||||
celp_filters.* Vitor Sessak
|
||||
cinepak.c Roberto Togni
|
||||
cinepakenc.c Rl / Aetey G.T. AB
|
||||
ccaption_dec.c Anshul Maheshwari, Aman Gupta
|
||||
ccaption_dec.c Anshul Maheshwari
|
||||
cljr Alex Beregszaszi
|
||||
cllc.c Derek Buitenhuis
|
||||
cook.c, cookdata.h Benjamin Larsson
|
||||
cpia.c Stephan Hilb
|
||||
crystalhd.c Philip Langdale
|
||||
cscd.c Reimar Doeffinger
|
||||
cuvid.c Timo Rothenpieler
|
||||
dca.c Kostya Shishkov, Benjamin Larsson
|
||||
dirac* Rostislav Pehlivanov
|
||||
dnxhd* Baptiste Coudurier
|
||||
dpcm.c Mike Melanson
|
||||
dss_sp.c Oleksij Rempel
|
||||
dss_sp.c Oleksij Rempel, Michael Niedermayer
|
||||
dv.c Roman Shaposhnik
|
||||
dvbsubdec.c Anshul Maheshwari
|
||||
dxa.c Kostya Shishkov
|
||||
eacmv*, eaidct*, eat* Peter Ross
|
||||
evrc* Paul B Mahol
|
||||
exif.c, exif.h Thilo Borgmann
|
||||
ffv1* Michael Niedermayer
|
||||
ffwavesynth.c Nicolas George
|
||||
fifo.c Jan Sebechlebsky
|
||||
fic.c Derek Buitenhuis
|
||||
flac* Justin Ruggles
|
||||
flashsv* Benjamin Larsson
|
||||
flicvideo.c Mike Melanson
|
||||
g722.c Martin Storsjo
|
||||
g726.c Roman Shaposhnik
|
||||
@@ -177,10 +190,16 @@ Codecs:
|
||||
hap* Tom Butterworth
|
||||
huffyuv* Michael Niedermayer, Christophe Gisquet
|
||||
idcinvideo.c Mike Melanson
|
||||
imc* Benjamin Larsson
|
||||
indeo2* Kostya Shishkov
|
||||
indeo5* Kostya Shishkov
|
||||
interplayvideo.c Mike Melanson
|
||||
jni*, ffjni* Matthieu Bouron
|
||||
ivi* Kostya Shishkov
|
||||
jacosub* Clément Bœsch
|
||||
jpeg2000* Nicolas Bertrand
|
||||
jpeg_ls.c Kostya Shishkov
|
||||
jvdec.c Peter Ross
|
||||
kmvc.c Kostya Shishkov
|
||||
lcl*.c Roberto Togni, Reimar Doeffinger
|
||||
libcelt_dec.c Nicolas George
|
||||
libdirac* David Conrad
|
||||
@@ -189,31 +208,40 @@ Codecs:
|
||||
libopenjpeg.c Jaikrishnan Menon
|
||||
libopenjpegenc.c Michael Bradshaw
|
||||
libschroedinger* David Conrad
|
||||
libspeexdec.c Justin Ruggles
|
||||
libtheoraenc.c David Conrad
|
||||
libutvideo* Carl Eugen Hoyos
|
||||
libvorbis.c David Conrad
|
||||
libvpx* James Zern
|
||||
libx264.c Mans Rullgard, Jason Garrett-Glaser
|
||||
libx265.c Derek Buitenhuis
|
||||
libxavs.c Stefan Gehrer
|
||||
libzvbi-teletextdec.c Marton Balint
|
||||
loco.c Kostya Shishkov
|
||||
lzo.h, lzo.c Reimar Doeffinger
|
||||
mdec.c Michael Niedermayer
|
||||
mimic.c Ramiro Polla
|
||||
mjpeg*.c Michael Niedermayer
|
||||
mlp* Ramiro Polla, Jai Luthra
|
||||
mlp* Ramiro Polla
|
||||
mmvideo.c Peter Ross
|
||||
mpc* Kostya Shishkov
|
||||
mpeg12.c, mpeg12data.h Michael Niedermayer
|
||||
mpegvideo.c, mpegvideo.h Michael Niedermayer
|
||||
mqc* Nicolas Bertrand
|
||||
msmpeg4.c, msmpeg4data.h Michael Niedermayer
|
||||
msrle.c Mike Melanson
|
||||
msvideo1.c Mike Melanson
|
||||
nellymoserdec.c Benjamin Larsson
|
||||
nuv.c Reimar Doeffinger
|
||||
nvenc* Timo Rothenpieler
|
||||
nvenc.c Timo Rothenpieler
|
||||
paf.* Paul B Mahol
|
||||
pcx.c Ivo van Poorten
|
||||
pgssubdec.c Reimar Doeffinger
|
||||
ptx.c Ivo van Poorten
|
||||
qcelp* Reynaldo H. Verdejo Pinochet
|
||||
qdm2.c, qdm2data.h Roberto Togni
|
||||
qdm2.c, qdm2data.h Roberto Togni, Benjamin Larsson
|
||||
qdrw.c Kostya Shishkov
|
||||
qpeg.c Kostya Shishkov
|
||||
qsv* Ivan Uskov
|
||||
qtrle.c Mike Melanson
|
||||
ra144.c, ra144.h, ra288.c, ra288.h Roberto Togni
|
||||
@@ -222,8 +250,10 @@ Codecs:
|
||||
rpza.c Roberto Togni
|
||||
rtjpeg.c, rtjpeg.h Reimar Doeffinger
|
||||
rv10.c Michael Niedermayer
|
||||
rv4* Christophe Gisquet
|
||||
rv3* Kostya Shishkov
|
||||
rv4* Kostya Shishkov, Christophe Gisquet
|
||||
s3tc* Ivo van Poorten
|
||||
smacker.c Kostya Shishkov
|
||||
smc.c Mike Melanson
|
||||
smvjpegdec.c Ash Hughes
|
||||
snow* Michael Niedermayer, Loren Merritt
|
||||
@@ -232,41 +262,54 @@ Codecs:
|
||||
sunrast.c Ivo van Poorten
|
||||
svq3.c Michael Niedermayer
|
||||
tak* Paul B Mahol
|
||||
targa.c Kostya Shishkov
|
||||
tiff.c Kostya Shishkov
|
||||
truemotion1* Mike Melanson
|
||||
truemotion2* Kostya Shishkov
|
||||
truespeech.c Kostya Shishkov
|
||||
tscc.c Kostya Shishkov
|
||||
tta.c Alex Beregszaszi, Jaikrishnan Menon
|
||||
ttaenc.c Paul B Mahol
|
||||
txd.c Ivo van Poorten
|
||||
vc1* Christophe Gisquet
|
||||
ulti* Kostya Shishkov
|
||||
v410*.c Derek Buitenhuis
|
||||
vb.c Kostya Shishkov
|
||||
vble.c Derek Buitenhuis
|
||||
vc1* Kostya Shishkov, Christophe Gisquet
|
||||
vc2* Rostislav Pehlivanov
|
||||
vcr1.c Michael Niedermayer
|
||||
vda_h264_dec.c Xidorn Quan
|
||||
videotoolboxenc.c Rick Kern
|
||||
vima.c Paul B Mahol
|
||||
vmnc.c Kostya Shishkov
|
||||
vorbisdec.c Denes Balatoni, David Conrad
|
||||
vorbisenc.c Oded Shimon
|
||||
vp3* Mike Melanson
|
||||
vp5 Aurelien Jacobs
|
||||
vp6 Aurelien Jacobs
|
||||
vp8 David Conrad, Ronald Bultje
|
||||
vp9 Ronald Bultje
|
||||
vp8 David Conrad, Jason Garrett-Glaser, Ronald Bultje
|
||||
vp9 Ronald Bultje, Clément Bœsch
|
||||
vqavideo.c Mike Melanson
|
||||
wavpack.c Kostya Shishkov
|
||||
wmaprodec.c Sascha Sommer
|
||||
wmavoice.c Ronald S. Bultje
|
||||
wmv2.c Michael Niedermayer
|
||||
wnv1.c Kostya Shishkov
|
||||
xan.c Mike Melanson
|
||||
xbm* Paul B Mahol
|
||||
xface Stefano Sabatini
|
||||
xl.c Kostya Shishkov
|
||||
xvmc.c Ivan Kalvachev
|
||||
xwd* Paul B Mahol
|
||||
zerocodec.c Derek Buitenhuis
|
||||
zmbv* Kostya Shishkov
|
||||
|
||||
Hardware acceleration:
|
||||
crystalhd.c Philip Langdale
|
||||
dxva2* Hendrik Leppkes, Laurent Aimar
|
||||
mediacodec* Matthieu Bouron
|
||||
vaapi* Gwenole Beauchesne
|
||||
vaapi_encode* Mark Thompson
|
||||
vda* Sebastien Zwickert
|
||||
vdpau* Philip Langdale, Carl Eugen Hoyos
|
||||
videotoolbox* Rick Kern
|
||||
videotoolbox* Sebastien Zwickert
|
||||
|
||||
|
||||
libavdevice
|
||||
@@ -287,7 +330,6 @@ libavdevice
|
||||
pulse_audio_enc.c Lukasz Marek
|
||||
qtkit.m Thilo Borgmann
|
||||
sdl Stefano Sabatini
|
||||
sdl2.c Josh de Kock
|
||||
v4l2.c Giorgio Vazzana
|
||||
vfwcap.c Ramiro Polla
|
||||
xv.c Lukasz Marek
|
||||
@@ -298,8 +340,6 @@ libavfilter
|
||||
Generic parts:
|
||||
graphdump.c Nicolas George
|
||||
|
||||
motion_estimation.c Davinder Singh
|
||||
|
||||
Filters:
|
||||
f_drawgraph.c Paul B Mahol
|
||||
af_adelay.c Paul B Mahol
|
||||
@@ -313,10 +353,7 @@ Filters:
|
||||
af_biquads.c Paul B Mahol
|
||||
af_chorus.c Paul B Mahol
|
||||
af_compand.c Paul B Mahol
|
||||
af_firequalizer.c Muhammad Faiz
|
||||
af_hdcd.c Burt P.
|
||||
af_ladspa.c Paul B Mahol
|
||||
af_loudnorm.c Kyle Swanson
|
||||
af_pan.c Nicolas George
|
||||
af_sidechaincompress.c Paul B Mahol
|
||||
af_silenceremove.c Paul B Mahol
|
||||
@@ -329,7 +366,6 @@ Filters:
|
||||
vf_colorbalance.c Paul B Mahol
|
||||
vf_colorkey.c Timo Rothenpieler
|
||||
vf_colorlevels.c Paul B Mahol
|
||||
vf_coreimage.m Thilo Borgmann
|
||||
vf_deband.c Paul B Mahol
|
||||
vf_dejudder.c Nicholas Robbins
|
||||
vf_delogo.c Jean Delvare (CC <jdelvare@suse.com>)
|
||||
@@ -341,12 +377,9 @@ Filters:
|
||||
vf_il.c Paul B Mahol
|
||||
vf_lenscorrection.c Daniel Oberhoff
|
||||
vf_mergeplanes.c Paul B Mahol
|
||||
vf_mestimate.c Davinder Singh
|
||||
vf_minterpolate.c Davinder Singh
|
||||
vf_neighbor.c Paul B Mahol
|
||||
vf_psnr.c Paul B Mahol
|
||||
vf_random.c Paul B Mahol
|
||||
vf_readvitc.c Tobias Rapp (CC t.rapp at noa-archive dot com)
|
||||
vf_scale.c Michael Niedermayer
|
||||
vf_separatefields.c Paul B Mahol
|
||||
vf_ssim.c Paul B Mahol
|
||||
@@ -366,7 +399,6 @@ Generic parts:
|
||||
libavformat/avformat.h Michael Niedermayer
|
||||
Utility Code:
|
||||
libavformat/utils.c Michael Niedermayer
|
||||
Text Subtitles Clément Bœsch
|
||||
|
||||
|
||||
Muxers/Demuxers:
|
||||
@@ -376,12 +408,13 @@ Muxers/Demuxers:
|
||||
afc.c Paul B Mahol
|
||||
aiffdec.c Baptiste Coudurier, Matthieu Bouron
|
||||
aiffenc.c Baptiste Coudurier, Matthieu Bouron
|
||||
ape.c Kostya Shishkov
|
||||
apngdec.c Benoit Fouet
|
||||
ass* Aurelien Jacobs
|
||||
astdec.c Paul B Mahol
|
||||
astenc.c James Almer
|
||||
avi* Michael Niedermayer
|
||||
avisynth.c Stephen Hutchinson
|
||||
avisynth.c AvxSynth Team (avxsynth.testing at gmail dot com)
|
||||
avr.c Paul B Mahol
|
||||
bink.c Peter Ross
|
||||
brstm.c Paul B Mahol
|
||||
@@ -389,18 +422,20 @@ Muxers/Demuxers:
|
||||
cdxl.c Paul B Mahol
|
||||
crc.c Michael Niedermayer
|
||||
daud.c Reimar Doeffinger
|
||||
dss.c Oleksij Rempel
|
||||
dss.c Oleksij Rempel, Michael Niedermayer
|
||||
dtshddec.c Paul B Mahol
|
||||
dv.c Roman Shaposhnik
|
||||
dxa.c Kostya Shishkov
|
||||
electronicarts.c Peter Ross
|
||||
epafdec.c Paul B Mahol
|
||||
ffm* Baptiste Coudurier
|
||||
flac* Justin Ruggles
|
||||
flic.c Mike Melanson
|
||||
flvdec.c, flvenc.c Michael Niedermayer
|
||||
gxf.c Reimar Doeffinger
|
||||
gxfenc.c Baptiste Coudurier
|
||||
hls.c Anssi Hannula
|
||||
hls encryption (hlsenc.c) Christian Suloway, Steven Liu
|
||||
hls encryption (hlsenc.c) Christian Suloway
|
||||
idcin.c Mike Melanson
|
||||
idroqdec.c Mike Melanson
|
||||
iff.c Jaikrishnan Menon
|
||||
@@ -408,10 +443,10 @@ Muxers/Demuxers:
|
||||
ipmovie.c Mike Melanson
|
||||
ircam* Paul B Mahol
|
||||
iss.c Stefan Gehrer
|
||||
jacosub* Clément Bœsch
|
||||
jvdec.c Peter Ross
|
||||
libmodplug.c Clément Bœsch
|
||||
libnut.c Oded Shimon
|
||||
libopenmpt.c Josh de Kock
|
||||
lmlm4.c Ivo van Poorten
|
||||
lvfdec.c Paul B Mahol
|
||||
lxfdec.c Tomas Härdin
|
||||
@@ -423,9 +458,10 @@ Muxers/Demuxers:
|
||||
mgsts.c Paul B Mahol
|
||||
microdvd* Aurelien Jacobs
|
||||
mm.c Peter Ross
|
||||
mov.c Baptiste Coudurier
|
||||
mov.c Michael Niedermayer, Baptiste Coudurier
|
||||
movenc.c Baptiste Coudurier, Matthieu Bouron
|
||||
movenccenc.c Eran Kornblau
|
||||
mpc.c Kostya Shishkov
|
||||
mpeg.c Michael Niedermayer
|
||||
mpegenc.c Michael Niedermayer
|
||||
mpegts.c Marton Balint
|
||||
@@ -451,7 +487,8 @@ Muxers/Demuxers:
|
||||
raw.c Michael Niedermayer
|
||||
rdt.c Ronald S. Bultje
|
||||
rl2.c Sascha Sommer
|
||||
rmdec.c, rmenc.c Ronald S. Bultje
|
||||
rmdec.c, rmenc.c Ronald S. Bultje, Kostya Shishkov
|
||||
rtmp* Kostya Shishkov
|
||||
rtp.c, rtpenc.c Martin Storsjo
|
||||
rtpdec_ac3.* Gilles Chanteperdrix
|
||||
rtpdec_dv.* Thomas Volkert
|
||||
@@ -459,13 +496,15 @@ Muxers/Demuxers:
|
||||
rtpdec_hevc.*, rtpenc_hevc.* Thomas Volkert
|
||||
rtpdec_mpa_robust.* Gilles Chanteperdrix
|
||||
rtpdec_asf.* Ronald S. Bultje
|
||||
rtpdec_vc2hq.*, rtpenc_vc2hq.* Thomas Volkert
|
||||
rtpdec_vp9.c Thomas Volkert
|
||||
rtpenc_mpv.*, rtpenc_aac.* Martin Storsjo
|
||||
rtsp.c Luca Barbato
|
||||
sbgdec.c Nicolas George
|
||||
sdp.c Martin Storsjo
|
||||
segafilm.c Mike Melanson
|
||||
segment.c Stefano Sabatini
|
||||
siff.c Kostya Shishkov
|
||||
smacker.c Kostya Shishkov
|
||||
smjpeg* Paul B Mahol
|
||||
spdif* Anssi Hannula
|
||||
srtdec.c Aurelien Jacobs
|
||||
@@ -480,6 +519,7 @@ Muxers/Demuxers:
|
||||
webvtt* Matthew J Heaney
|
||||
westwood.c Mike Melanson
|
||||
wtv.c Peter Ross
|
||||
wv.c Kostya Shishkov
|
||||
wvenc.c Paul B Mahol
|
||||
|
||||
Protocols:
|
||||
@@ -510,17 +550,20 @@ Resamplers:
|
||||
Operating systems / CPU architectures
|
||||
=====================================
|
||||
|
||||
Alpha Falk Hueffner
|
||||
MIPS Nedeljko Babic
|
||||
Alpha Mans Rullgard, Falk Hueffner
|
||||
ARM Mans Rullgard
|
||||
AVR32 Mans Rullgard
|
||||
MIPS Mans Rullgard, Nedeljko Babic
|
||||
Mac OS X / PowerPC Romain Dolbeau, Guillaume Poirier
|
||||
Amiga / PowerPC Colin Ward
|
||||
Linux / PowerPC Luca Barbato
|
||||
Windows MinGW Alex Beregszaszi, Ramiro Polla
|
||||
Windows Cygwin Victor Paesa
|
||||
Windows MSVC Matthew Oliver, Hendrik Leppkes
|
||||
Windows ICL Matthew Oliver
|
||||
ADI/Blackfin DSP Marc Hoffman
|
||||
Sparc Roman Shaposhnik
|
||||
OS/2 KO Myung-Hun
|
||||
x86 Michael Niedermayer
|
||||
|
||||
|
||||
Releases
|
||||
@@ -530,6 +573,7 @@ Releases
|
||||
2.7 Michael Niedermayer
|
||||
2.6 Michael Niedermayer
|
||||
2.5 Michael Niedermayer
|
||||
2.4 Michael Niedermayer
|
||||
|
||||
If you want to maintain an older release, please contact us
|
||||
|
||||
@@ -539,6 +583,7 @@ GnuPG Fingerprints of maintainers and contributors
|
||||
|
||||
Alexander Strasser 1C96 78B7 83CB 8AA7 9AF5 D1EB A7D8 A57B A876 E58F
|
||||
Anssi Hannula 1A92 FF42 2DD9 8D2E 8AF7 65A9 4278 C520 513D F3CB
|
||||
Anton Khirnov 6D0C 6625 56F8 65D1 E5F5 814B B50A 1241 C067 07AB
|
||||
Ash Hughes 694D 43D2 D180 C7C7 6421 ABD3 A641 D0B7 623D 6029
|
||||
Attila Kinali 11F0 F9A6 A1D2 11F6 C745 D10C 6520 BCDD F2DF E765
|
||||
Baptiste Coudurier 8D77 134D 20CC 9220 201F C5DB 0AC9 325C 5C1A BAAA
|
||||
@@ -546,16 +591,18 @@ Ben Littler 3EE3 3723 E560 3214 A8CD 4DEB 2CDB FCE7 768C 8D2C
|
||||
Benoit Fouet B22A 4F4F 43EF 636B BB66 FCDC 0023 AE1E 2985 49C8
|
||||
Clément Bœsch 52D0 3A82 D445 F194 DB8B 2B16 87EE 2CB8 F4B8 FCF9
|
||||
Daniel Verkamp 78A6 07ED 782C 653E C628 B8B9 F0EB 8DD8 2F0E 21C7
|
||||
Diego Biurrun 8227 1E31 B6D9 4994 7427 E220 9CAE D6CC 4757 FCC5
|
||||
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
|
||||
Jaikrishnan Menon 61A1 F09F 01C9 2D45 78E1 C862 25DC 8831 AF70 D368
|
||||
Jean Delvare 7CA6 9F44 60F1 BDC4 1FD2 C858 A552 6B9B B3CD 4E6A
|
||||
Justin Ruggles 3136 ECC0 C10D 6C04 5F43 CA29 FCBE CD2A 3787 1EBF
|
||||
Loren Merritt ABD9 08F4 C920 3F65 D8BE 35D7 1540 DAA7 060F 56DE
|
||||
Lou Logan 7D68 DC73 CBEF EABB 671A B6CF 621C 2E28 82F8 DC3A
|
||||
Luca Barbato 6677 4209 213C 8843 5B67 29E7 E84C 78C2 84E9 0E34
|
||||
Michael Niedermayer 9FF2 128B 147E F673 0BAD F133 611E C787 040B 0FAB
|
||||
Nicolas George 24CE 01CE 9ACC 5CEB 74D8 8D9D B063 D997 36E5 4C93
|
||||
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
|
||||
Philip Langdale 5DC5 8D66 5FBA 3A43 18EC 045E F8D6 B194 6A75 682E
|
||||
|
||||
17
Makefile
17
Makefile
@@ -30,18 +30,16 @@ $(foreach prog,$(AVBASENAMES),$(eval OBJS-$(prog) += cmdutils.o))
|
||||
$(foreach prog,$(AVBASENAMES),$(eval OBJS-$(prog)-$(CONFIG_OPENCL) += cmdutils_opencl.o))
|
||||
|
||||
OBJS-ffmpeg += ffmpeg_opt.o ffmpeg_filter.o
|
||||
OBJS-ffmpeg-$(CONFIG_VIDEOTOOLBOX) += ffmpeg_videotoolbox.o
|
||||
OBJS-ffmpeg-$(CONFIG_LIBMFX) += ffmpeg_qsv.o
|
||||
OBJS-ffmpeg-$(CONFIG_VAAPI) += ffmpeg_vaapi.o
|
||||
OBJS-ffmpeg-$(HAVE_VDPAU_X11) += ffmpeg_vdpau.o
|
||||
OBJS-ffmpeg-$(HAVE_DXVA2_LIB) += ffmpeg_dxva2.o
|
||||
ifndef CONFIG_VIDEOTOOLBOX
|
||||
OBJS-ffmpeg-$(CONFIG_VDA) += ffmpeg_videotoolbox.o
|
||||
endif
|
||||
OBJS-ffmpeg-$(CONFIG_CUVID) += ffmpeg_cuvid.o
|
||||
OBJS-ffmpeg-$(HAVE_DXVA2_LIB) += ffmpeg_dxva2.o
|
||||
OBJS-ffmpeg-$(HAVE_VDPAU_X11) += ffmpeg_vdpau.o
|
||||
OBJS-ffmpeg-$(CONFIG_VIDEOTOOLBOX) += ffmpeg_videotoolbox.o
|
||||
OBJS-ffmpeg-$(CONFIG_LIBMFX) += ffmpeg_qsv.o
|
||||
OBJS-ffserver += ffserver_config.o
|
||||
|
||||
TESTTOOLS = audiogen videogen rotozoom tiny_psnr tiny_ssim base64 audiomatch
|
||||
TESTTOOLS = audiogen videogen rotozoom tiny_psnr tiny_ssim base64
|
||||
HOSTPROGS := $(TESTTOOLS:%=tests/%) doc/print_options
|
||||
TOOLS = qt-faststart trasher uncoded_frame
|
||||
TOOLS-$(CONFIG_ZLIB) += cws2fws
|
||||
@@ -61,8 +59,7 @@ FFLIBS := avutil
|
||||
DATA_FILES := $(wildcard $(SRC_PATH)/presets/*.ffpreset) $(SRC_PATH)/doc/ffprobe.xsd
|
||||
EXAMPLES_FILES := $(wildcard $(SRC_PATH)/doc/examples/*.c) $(SRC_PATH)/doc/examples/Makefile $(SRC_PATH)/doc/examples/README
|
||||
|
||||
SKIPHEADERS = cmdutils_common_opts.h \
|
||||
compat/w32pthreads.h
|
||||
SKIPHEADERS = cmdutils_common_opts.h compat/w32pthreads.h
|
||||
|
||||
include $(SRC_PATH)/common.mak
|
||||
|
||||
@@ -184,7 +181,7 @@ clean::
|
||||
|
||||
distclean::
|
||||
$(RM) $(DISTCLEANSUFFIXES)
|
||||
$(RM) config.* .config libavutil/avconfig.h .version mapfile avversion.h version.h libavutil/ffversion.h libavcodec/codec_names.h libavcodec/bsf_list.c libavformat/protocol_list.c
|
||||
$(RM) config.* .config libavutil/avconfig.h .version avversion.h version.h libavutil/ffversion.h libavcodec/codec_names.h
|
||||
ifeq ($(SRC_LINK),src)
|
||||
$(RM) src
|
||||
endif
|
||||
|
||||
@@ -45,4 +45,5 @@ GPL. Please refer to the LICENSE file for detailed information.
|
||||
|
||||
Patches should be submitted to the ffmpeg-devel mailing list using
|
||||
`git format-patch` or `git send-email`. Github pull requests should be
|
||||
avoided because they are not part of our review process and will be ignored.
|
||||
avoided because they are not part of our review process. Few developers
|
||||
follow pull requests so they will likely be ignored.
|
||||
|
||||
15
RELEASE_NOTES
Normal file
15
RELEASE_NOTES
Normal file
@@ -0,0 +1,15 @@
|
||||
|
||||
┌─────────────────────────────────────────┐
|
||||
│ RELEASE NOTES for FFmpeg 3.0 "Einstein" │
|
||||
└─────────────────────────────────────────┘
|
||||
|
||||
The FFmpeg Project proudly presents FFmpeg 3.0 "Einstein", about 5
|
||||
months after the release of FFmpeg 2.8.
|
||||
|
||||
A complete Changelog is available at the root of the project, and the
|
||||
complete Git history on http://source.ffmpeg.org.
|
||||
|
||||
We hope you will like this release as much as we enjoyed working on it, and
|
||||
as usual, if you have any questions about it, or any FFmpeg related topic,
|
||||
feel free to join us on the #ffmpeg IRC channel (on irc.freenode.net) or ask
|
||||
on the mailing-lists.
|
||||
25
cmdutils.c
25
cmdutils.c
@@ -61,9 +61,6 @@
|
||||
#include <sys/time.h>
|
||||
#include <sys/resource.h>
|
||||
#endif
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
static int init_report(const char *env);
|
||||
|
||||
@@ -110,15 +107,6 @@ static void log_callback_report(void *ptr, int level, const char *fmt, va_list v
|
||||
}
|
||||
}
|
||||
|
||||
void init_dynload(void)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
/* Calling SetDllDirectory with the empty string (but not NULL) removes the
|
||||
* current working directory from the DLL search path as a security pre-caution. */
|
||||
SetDllDirectory("");
|
||||
#endif
|
||||
}
|
||||
|
||||
static void (*program_exit)(int ret);
|
||||
|
||||
void register_exit(void (*cb)(int ret))
|
||||
@@ -1579,11 +1567,10 @@ int show_encoders(void *optctx, const char *opt, const char *arg)
|
||||
|
||||
int show_bsfs(void *optctx, const char *opt, const char *arg)
|
||||
{
|
||||
const AVBitStreamFilter *bsf = NULL;
|
||||
void *opaque = NULL;
|
||||
AVBitStreamFilter *bsf = NULL;
|
||||
|
||||
printf("Bitstream filters:\n");
|
||||
while ((bsf = av_bsf_next(&opaque)))
|
||||
while ((bsf = av_bitstream_filter_next(bsf)))
|
||||
printf("%s\n", bsf->name);
|
||||
printf("\n");
|
||||
return 0;
|
||||
@@ -1994,7 +1981,7 @@ AVDictionary *filter_codec_opts(AVDictionary *opts, enum AVCodecID codec_id,
|
||||
codec = s->oformat ? avcodec_find_encoder(codec_id)
|
||||
: avcodec_find_decoder(codec_id);
|
||||
|
||||
switch (st->codecpar->codec_type) {
|
||||
switch (st->codec->codec_type) {
|
||||
case AVMEDIA_TYPE_VIDEO:
|
||||
prefix = 'v';
|
||||
flags |= AV_OPT_FLAG_VIDEO_PARAM;
|
||||
@@ -2052,7 +2039,7 @@ AVDictionary **setup_find_stream_info_opts(AVFormatContext *s,
|
||||
return NULL;
|
||||
}
|
||||
for (i = 0; i < s->nb_streams; i++)
|
||||
opts[i] = filter_codec_opts(codec_opts, s->streams[i]->codecpar->codec_id,
|
||||
opts[i] = filter_codec_opts(codec_opts, s->streams[i]->codec->codec_id,
|
||||
s, s->streams[i], NULL);
|
||||
return opts;
|
||||
}
|
||||
@@ -2112,7 +2099,7 @@ static int print_device_sources(AVInputFormat *fmt, AVDictionary *opts)
|
||||
if (!fmt || !fmt->priv_class || !AV_IS_INPUT_DEVICE(fmt->priv_class->category))
|
||||
return AVERROR(EINVAL);
|
||||
|
||||
printf("Auto-detected sources for %s:\n", fmt->name);
|
||||
printf("Audo-detected sources for %s:\n", fmt->name);
|
||||
if (!fmt->get_device_list) {
|
||||
ret = AVERROR(ENOSYS);
|
||||
printf("Cannot list sources. Not implemented.\n");
|
||||
@@ -2142,7 +2129,7 @@ static int print_device_sinks(AVOutputFormat *fmt, AVDictionary *opts)
|
||||
if (!fmt || !fmt->priv_class || !AV_IS_OUTPUT_DEVICE(fmt->priv_class->category))
|
||||
return AVERROR(EINVAL);
|
||||
|
||||
printf("Auto-detected sinks for %s:\n", fmt->name);
|
||||
printf("Audo-detected sinks for %s:\n", fmt->name);
|
||||
if (!fmt->get_device_list) {
|
||||
ret = AVERROR(ENOSYS);
|
||||
printf("Cannot list sinks. Not implemented.\n");
|
||||
|
||||
@@ -61,11 +61,6 @@ void register_exit(void (*cb)(int ret));
|
||||
*/
|
||||
void exit_program(int ret) av_noreturn;
|
||||
|
||||
/**
|
||||
* Initialize dynamic library loading
|
||||
*/
|
||||
void init_dynload(void);
|
||||
|
||||
/**
|
||||
* Initialize the cmdutils option system, in particular
|
||||
* allocate the *_opts contexts.
|
||||
@@ -450,13 +445,13 @@ int show_devices(void *optctx, const char *opt, const char *arg);
|
||||
|
||||
#if CONFIG_AVDEVICE
|
||||
/**
|
||||
* Print a listing containing autodetected sinks of the output device.
|
||||
* Print a listing containing audodetected 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.
|
||||
* Print a listing containing audodetected 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);
|
||||
|
||||
19
common.mak
19
common.mak
@@ -39,7 +39,7 @@ CCFLAGS = $(CPPFLAGS) $(CFLAGS)
|
||||
OBJCFLAGS += $(EOBJCFLAGS)
|
||||
OBJCCFLAGS = $(CPPFLAGS) $(CFLAGS) $(OBJCFLAGS)
|
||||
ASFLAGS := $(CPPFLAGS) $(ASFLAGS)
|
||||
CXXFLAGS := $(CPPFLAGS) $(CFLAGS) $(CXXFLAGS)
|
||||
CXXFLAGS += $(CPPFLAGS) $(CFLAGS)
|
||||
YASMFLAGS += $(IFLAGS:%=%/) -Pconfig.asm
|
||||
|
||||
HOSTCCFLAGS = $(IFLAGS) $(HOSTCPPFLAGS) $(HOSTCFLAGS)
|
||||
@@ -83,7 +83,12 @@ COMPILE_HOSTC = $(call COMPILE,HOSTCC)
|
||||
%.h.c:
|
||||
$(Q)echo '#include "$*.h"' >$@
|
||||
|
||||
%.c %.h %.ver: TAG = GEN
|
||||
%.ver: %.v
|
||||
$(Q)sed 's/$$MAJOR/$($(basename $(@F))_VERSION_MAJOR)/' $^ | sed -e 's/:/:\
|
||||
/' -e 's/; /;\
|
||||
/g' > $@
|
||||
|
||||
%.c %.h: TAG = GEN
|
||||
|
||||
# Dummy rule to stop make trying to rebuild removed or renamed headers
|
||||
%.h:
|
||||
@@ -109,8 +114,8 @@ FFEXTRALIBS := $(LDLIBS:%=$(LD_LIB)) $(EXTRALIBS)
|
||||
|
||||
OBJS := $(sort $(OBJS:%=$(SUBDIR)%))
|
||||
SLIBOBJS := $(sort $(SLIBOBJS:%=$(SUBDIR)%))
|
||||
TESTOBJS := $(TESTOBJS:%=$(SUBDIR)tests/%) $(TESTPROGS:%=$(SUBDIR)tests/%.o)
|
||||
TESTPROGS := $(TESTPROGS:%=$(SUBDIR)tests/%$(EXESUF))
|
||||
TESTOBJS := $(TESTOBJS:%=$(SUBDIR)%) $(TESTPROGS:%=$(SUBDIR)%-test.o)
|
||||
TESTPROGS := $(TESTPROGS:%=$(SUBDIR)%-test$(EXESUF))
|
||||
HOSTOBJS := $(HOSTPROGS:%=$(SUBDIR)%.o)
|
||||
HOSTPROGS := $(HOSTPROGS:%=$(SUBDIR)%$(HOSTEXESUF))
|
||||
TOOLS += $(TOOLS-yes)
|
||||
@@ -147,13 +152,15 @@ $(TOOLOBJS): | tools
|
||||
|
||||
OBJDIRS := $(OBJDIRS) $(dir $(OBJS) $(HOBJS) $(HOSTOBJS) $(SLIBOBJS) $(TESTOBJS))
|
||||
|
||||
CLEANSUFFIXES = *.d *.o *~ *.h.c *.gcda *.gcno *.map *.ver *.ho *$(DEFAULT_YASMD).asm
|
||||
CLEANSUFFIXES = *.d *.o *~ *.h.c *.map *.ver *.ver-sol2 *.ho *.gcno *.gcda *$(DEFAULT_YASMD).asm
|
||||
DISTCLEANSUFFIXES = *.pc
|
||||
LIBSUFFIXES = *.a *.lib *.so *.so.* *.dylib *.dll *.def *.dll.a
|
||||
|
||||
define RULES
|
||||
clean::
|
||||
$(RM) $(HOSTPROGS) $(TESTPROGS) $(TOOLS)
|
||||
$(RM) $(OBJS) $(OBJS:.o=.d) $(OBJS:.o=$(DEFAULT_YASMD).d)
|
||||
$(RM) $(HOSTPROGS)
|
||||
$(RM) $(TOOLS)
|
||||
endef
|
||||
|
||||
$(eval $(RULES))
|
||||
|
||||
@@ -75,149 +75,54 @@ enum {AVS_PLANAR_Y=1<<0,
|
||||
AVS_PLANAR_B_ALIGNED=AVS_PLANAR_B|AVS_PLANAR_ALIGNED};
|
||||
|
||||
// Colorspace properties.
|
||||
enum {
|
||||
AVS_CS_YUVA = 1 << 27,
|
||||
AVS_CS_BGR = 1 << 28,
|
||||
AVS_CS_YUV = 1 << 29,
|
||||
AVS_CS_INTERLEAVED = 1 << 30,
|
||||
AVS_CS_PLANAR = 1 << 31,
|
||||
enum {AVS_CS_BGR = 1<<28,
|
||||
AVS_CS_YUV = 1<<29,
|
||||
AVS_CS_INTERLEAVED = 1<<30,
|
||||
AVS_CS_PLANAR = 1<<31,
|
||||
|
||||
AVS_CS_SHIFT_SUB_WIDTH = 0,
|
||||
AVS_CS_SHIFT_SUB_HEIGHT = 8,
|
||||
AVS_CS_SHIFT_SAMPLE_BITS = 16,
|
||||
AVS_CS_SHIFT_SUB_WIDTH = 0,
|
||||
AVS_CS_SHIFT_SUB_HEIGHT = 8,
|
||||
AVS_CS_SHIFT_SAMPLE_BITS = 16,
|
||||
|
||||
AVS_CS_SUB_WIDTH_MASK = 7 << AVS_CS_SHIFT_SUB_WIDTH,
|
||||
AVS_CS_SUB_WIDTH_1 = 3 << AVS_CS_SHIFT_SUB_WIDTH, // YV24
|
||||
AVS_CS_SUB_WIDTH_2 = 0 << AVS_CS_SHIFT_SUB_WIDTH, // YV12, I420, YV16
|
||||
AVS_CS_SUB_WIDTH_4 = 1 << AVS_CS_SHIFT_SUB_WIDTH, // YUV9, YV411
|
||||
AVS_CS_SUB_WIDTH_MASK = 7 << AVS_CS_SHIFT_SUB_WIDTH,
|
||||
AVS_CS_SUB_WIDTH_1 = 3 << AVS_CS_SHIFT_SUB_WIDTH, // YV24
|
||||
AVS_CS_SUB_WIDTH_2 = 0 << AVS_CS_SHIFT_SUB_WIDTH, // YV12, I420, YV16
|
||||
AVS_CS_SUB_WIDTH_4 = 1 << AVS_CS_SHIFT_SUB_WIDTH, // YUV9, YV411
|
||||
|
||||
AVS_CS_VPLANEFIRST = 1 << 3, // YV12, YV16, YV24, YV411, YUV9
|
||||
AVS_CS_UPLANEFIRST = 1 << 4, // I420
|
||||
AVS_CS_VPLANEFIRST = 1 << 3, // YV12, YV16, YV24, YV411, YUV9
|
||||
AVS_CS_UPLANEFIRST = 1 << 4, // I420
|
||||
|
||||
AVS_CS_SUB_HEIGHT_MASK = 7 << AVS_CS_SHIFT_SUB_HEIGHT,
|
||||
AVS_CS_SUB_HEIGHT_1 = 3 << AVS_CS_SHIFT_SUB_HEIGHT, // YV16, YV24, YV411
|
||||
AVS_CS_SUB_HEIGHT_2 = 0 << AVS_CS_SHIFT_SUB_HEIGHT, // YV12, I420
|
||||
AVS_CS_SUB_HEIGHT_4 = 1 << AVS_CS_SHIFT_SUB_HEIGHT, // YUV9
|
||||
AVS_CS_SUB_HEIGHT_MASK = 7 << AVS_CS_SHIFT_SUB_HEIGHT,
|
||||
AVS_CS_SUB_HEIGHT_1 = 3 << AVS_CS_SHIFT_SUB_HEIGHT, // YV16, YV24, YV411
|
||||
AVS_CS_SUB_HEIGHT_2 = 0 << AVS_CS_SHIFT_SUB_HEIGHT, // YV12, I420
|
||||
AVS_CS_SUB_HEIGHT_4 = 1 << AVS_CS_SHIFT_SUB_HEIGHT, // YUV9
|
||||
|
||||
AVS_CS_SAMPLE_BITS_MASK = 7 << AVS_CS_SHIFT_SAMPLE_BITS,
|
||||
AVS_CS_SAMPLE_BITS_8 = 0 << AVS_CS_SHIFT_SAMPLE_BITS,
|
||||
AVS_CS_SAMPLE_BITS_10 = 5 << AVS_CS_SHIFT_SAMPLE_BITS,
|
||||
AVS_CS_SAMPLE_BITS_12 = 6 << AVS_CS_SHIFT_SAMPLE_BITS,
|
||||
AVS_CS_SAMPLE_BITS_14 = 7 << AVS_CS_SHIFT_SAMPLE_BITS,
|
||||
AVS_CS_SAMPLE_BITS_16 = 1 << AVS_CS_SHIFT_SAMPLE_BITS,
|
||||
AVS_CS_SAMPLE_BITS_32 = 2 << AVS_CS_SHIFT_SAMPLE_BITS,
|
||||
|
||||
AVS_CS_PLANAR_MASK = AVS_CS_PLANAR | AVS_CS_INTERLEAVED | AVS_CS_YUV | AVS_CS_BGR | AVS_CS_YUVA | AVS_CS_SAMPLE_BITS_MASK | AVS_CS_SUB_HEIGHT_MASK | AVS_CS_SUB_WIDTH_MASK,
|
||||
AVS_CS_PLANAR_FILTER = ~(AVS_CS_VPLANEFIRST | AVS_CS_UPLANEFIRST),
|
||||
|
||||
AVS_CS_RGB_TYPE = 1 << 0,
|
||||
AVS_CS_RGBA_TYPE = 1 << 1,
|
||||
|
||||
AVS_CS_GENERIC_YUV420 = AVS_CS_PLANAR | AVS_CS_YUV | AVS_CS_VPLANEFIRST | AVS_CS_SUB_HEIGHT_2 | AVS_CS_SUB_WIDTH_2, // 4:2:0 planar
|
||||
AVS_CS_GENERIC_YUV422 = AVS_CS_PLANAR | AVS_CS_YUV | AVS_CS_VPLANEFIRST | AVS_CS_SUB_HEIGHT_1 | AVS_CS_SUB_WIDTH_2, // 4:2:2 planar
|
||||
AVS_CS_GENERIC_YUV444 = AVS_CS_PLANAR | AVS_CS_YUV | AVS_CS_VPLANEFIRST | AVS_CS_SUB_HEIGHT_1 | AVS_CS_SUB_WIDTH_1, // 4:4:4 planar
|
||||
AVS_CS_GENERIC_Y = AVS_CS_PLANAR | AVS_CS_INTERLEAVED | AVS_CS_YUV, // Y only (4:0:0)
|
||||
AVS_CS_GENERIC_RGBP = AVS_CS_PLANAR | AVS_CS_BGR | AVS_CS_RGB_TYPE, // planar RGB
|
||||
AVS_CS_GENERIC_RGBAP = AVS_CS_PLANAR | AVS_CS_BGR | AVS_CS_RGBA_TYPE, // planar RGBA
|
||||
AVS_CS_GENERIC_YUVA420 = AVS_CS_PLANAR | AVS_CS_YUVA | AVS_CS_VPLANEFIRST | AVS_CS_SUB_HEIGHT_2 | AVS_CS_SUB_WIDTH_2, // 4:2:0:A planar
|
||||
AVS_CS_GENERIC_YUVA422 = AVS_CS_PLANAR | AVS_CS_YUVA | AVS_CS_VPLANEFIRST | AVS_CS_SUB_HEIGHT_1 | AVS_CS_SUB_WIDTH_2, // 4:2:2:A planar
|
||||
AVS_CS_GENERIC_YUVA444 = AVS_CS_PLANAR | AVS_CS_YUVA | AVS_CS_VPLANEFIRST | AVS_CS_SUB_HEIGHT_1 | AVS_CS_SUB_WIDTH_1 }; // 4:4:4:A planar
|
||||
AVS_CS_SAMPLE_BITS_MASK = 7 << AVS_CS_SHIFT_SAMPLE_BITS,
|
||||
AVS_CS_SAMPLE_BITS_8 = 0 << AVS_CS_SHIFT_SAMPLE_BITS,
|
||||
AVS_CS_SAMPLE_BITS_16 = 1 << AVS_CS_SHIFT_SAMPLE_BITS,
|
||||
AVS_CS_SAMPLE_BITS_32 = 2 << AVS_CS_SHIFT_SAMPLE_BITS,
|
||||
|
||||
AVS_CS_PLANAR_MASK = AVS_CS_PLANAR | AVS_CS_INTERLEAVED | AVS_CS_YUV | AVS_CS_BGR | AVS_CS_SAMPLE_BITS_MASK | AVS_CS_SUB_HEIGHT_MASK | AVS_CS_SUB_WIDTH_MASK,
|
||||
AVS_CS_PLANAR_FILTER = ~( AVS_CS_VPLANEFIRST | AVS_CS_UPLANEFIRST )};
|
||||
|
||||
// Specific colorformats
|
||||
enum {
|
||||
AVS_CS_UNKNOWN = 0,
|
||||
AVS_CS_BGR24 = AVS_CS_RGB_TYPE | AVS_CS_BGR | AVS_CS_INTERLEAVED,
|
||||
AVS_CS_BGR32 = AVS_CS_RGBA_TYPE | AVS_CS_BGR | AVS_CS_INTERLEAVED,
|
||||
AVS_CS_BGR24 = 1<<0 | AVS_CS_BGR | AVS_CS_INTERLEAVED,
|
||||
AVS_CS_BGR32 = 1<<1 | AVS_CS_BGR | AVS_CS_INTERLEAVED,
|
||||
AVS_CS_YUY2 = 1<<2 | AVS_CS_YUV | AVS_CS_INTERLEAVED,
|
||||
// AVS_CS_YV12 = 1<<3 Reserved
|
||||
// AVS_CS_I420 = 1<<4 Reserved
|
||||
AVS_CS_RAW32 = 1<<5 | AVS_CS_INTERLEAVED,
|
||||
|
||||
AVS_CS_YV24 = AVS_CS_GENERIC_YUV444 | AVS_CS_SAMPLE_BITS_8, // YVU 4:4:4 planar
|
||||
AVS_CS_YV16 = AVS_CS_GENERIC_YUV422 | AVS_CS_SAMPLE_BITS_8, // YVU 4:2:2 planar
|
||||
AVS_CS_YV12 = AVS_CS_GENERIC_YUV420 | AVS_CS_SAMPLE_BITS_8, // YVU 4:2:0 planar
|
||||
AVS_CS_YV24 = AVS_CS_PLANAR | AVS_CS_YUV | AVS_CS_SAMPLE_BITS_8 | AVS_CS_VPLANEFIRST | AVS_CS_SUB_HEIGHT_1 | AVS_CS_SUB_WIDTH_1, // YVU 4:4:4 planar
|
||||
AVS_CS_YV16 = AVS_CS_PLANAR | AVS_CS_YUV | AVS_CS_SAMPLE_BITS_8 | AVS_CS_VPLANEFIRST | AVS_CS_SUB_HEIGHT_1 | AVS_CS_SUB_WIDTH_2, // YVU 4:2:2 planar
|
||||
AVS_CS_YV12 = AVS_CS_PLANAR | AVS_CS_YUV | AVS_CS_SAMPLE_BITS_8 | AVS_CS_VPLANEFIRST | AVS_CS_SUB_HEIGHT_2 | AVS_CS_SUB_WIDTH_2, // YVU 4:2:0 planar
|
||||
AVS_CS_I420 = AVS_CS_PLANAR | AVS_CS_YUV | AVS_CS_SAMPLE_BITS_8 | AVS_CS_UPLANEFIRST | AVS_CS_SUB_HEIGHT_2 | AVS_CS_SUB_WIDTH_2, // YUV 4:2:0 planar
|
||||
AVS_CS_IYUV = AVS_CS_I420,
|
||||
AVS_CS_YV411 = AVS_CS_PLANAR | AVS_CS_YUV | AVS_CS_SAMPLE_BITS_8 | AVS_CS_VPLANEFIRST | AVS_CS_SUB_HEIGHT_1 | AVS_CS_SUB_WIDTH_4, // YVU 4:1:1 planar
|
||||
AVS_CS_YUV9 = AVS_CS_PLANAR | AVS_CS_YUV | AVS_CS_SAMPLE_BITS_8 | AVS_CS_VPLANEFIRST | AVS_CS_SUB_HEIGHT_4 | AVS_CS_SUB_WIDTH_4, // YVU 4:1:0 planar
|
||||
AVS_CS_Y8 = AVS_CS_GENERIC_Y | AVS_CS_SAMPLE_BITS_8, // Y 4:0:0 planar
|
||||
|
||||
//-------------------------
|
||||
// AVS16: new planar constants go live! Experimental PF 160613
|
||||
// 10-12-14 bit + planar RGB + BRG48/64 160725
|
||||
AVS_CS_YUV444P10 = AVS_CS_GENERIC_YUV444 | AVS_CS_SAMPLE_BITS_10, // YUV 4:4:4 10bit samples
|
||||
AVS_CS_YUV422P10 = AVS_CS_GENERIC_YUV422 | AVS_CS_SAMPLE_BITS_10, // YUV 4:2:2 10bit samples
|
||||
AVS_CS_YUV420P10 = AVS_CS_GENERIC_YUV420 | AVS_CS_SAMPLE_BITS_10, // YUV 4:2:0 10bit samples
|
||||
AVS_CS_Y10 = AVS_CS_GENERIC_Y | AVS_CS_SAMPLE_BITS_10, // Y 4:0:0 10bit samples
|
||||
|
||||
AVS_CS_YUV444P12 = AVS_CS_GENERIC_YUV444 | AVS_CS_SAMPLE_BITS_12, // YUV 4:4:4 12bit samples
|
||||
AVS_CS_YUV422P12 = AVS_CS_GENERIC_YUV422 | AVS_CS_SAMPLE_BITS_12, // YUV 4:2:2 12bit samples
|
||||
AVS_CS_YUV420P12 = AVS_CS_GENERIC_YUV420 | AVS_CS_SAMPLE_BITS_12, // YUV 4:2:0 12bit samples
|
||||
AVS_CS_Y12 = AVS_CS_GENERIC_Y | AVS_CS_SAMPLE_BITS_12, // Y 4:0:0 12bit samples
|
||||
|
||||
AVS_CS_YUV444P14 = AVS_CS_GENERIC_YUV444 | AVS_CS_SAMPLE_BITS_14, // YUV 4:4:4 14bit samples
|
||||
AVS_CS_YUV422P14 = AVS_CS_GENERIC_YUV422 | AVS_CS_SAMPLE_BITS_14, // YUV 4:2:2 14bit samples
|
||||
AVS_CS_YUV420P14 = AVS_CS_GENERIC_YUV420 | AVS_CS_SAMPLE_BITS_14, // YUV 4:2:0 14bit samples
|
||||
AVS_CS_Y14 = AVS_CS_GENERIC_Y | AVS_CS_SAMPLE_BITS_14, // Y 4:0:0 14bit samples
|
||||
|
||||
AVS_CS_YUV444P16 = AVS_CS_GENERIC_YUV444 | AVS_CS_SAMPLE_BITS_16, // YUV 4:4:4 16bit samples
|
||||
AVS_CS_YUV422P16 = AVS_CS_GENERIC_YUV422 | AVS_CS_SAMPLE_BITS_16, // YUV 4:2:2 16bit samples
|
||||
AVS_CS_YUV420P16 = AVS_CS_GENERIC_YUV420 | AVS_CS_SAMPLE_BITS_16, // YUV 4:2:0 16bit samples
|
||||
AVS_CS_Y16 = AVS_CS_GENERIC_Y | AVS_CS_SAMPLE_BITS_16, // Y 4:0:0 16bit samples
|
||||
|
||||
// 32 bit samples (float)
|
||||
AVS_CS_YUV444PS = AVS_CS_GENERIC_YUV444 | AVS_CS_SAMPLE_BITS_32, // YUV 4:4:4 32bit samples
|
||||
AVS_CS_YUV422PS = AVS_CS_GENERIC_YUV422 | AVS_CS_SAMPLE_BITS_32, // YUV 4:2:2 32bit samples
|
||||
AVS_CS_YUV420PS = AVS_CS_GENERIC_YUV420 | AVS_CS_SAMPLE_BITS_32, // YUV 4:2:0 32bit samples
|
||||
AVS_CS_Y32 = AVS_CS_GENERIC_Y | AVS_CS_SAMPLE_BITS_32, // Y 4:0:0 32bit samples
|
||||
|
||||
// RGB packed
|
||||
AVS_CS_BGR48 = AVS_CS_RGB_TYPE | AVS_CS_BGR | AVS_CS_INTERLEAVED | AVS_CS_SAMPLE_BITS_16, // BGR 3x16 bit
|
||||
AVS_CS_BGR64 = AVS_CS_RGBA_TYPE | AVS_CS_BGR | AVS_CS_INTERLEAVED | AVS_CS_SAMPLE_BITS_16, // BGR 4x16 bit
|
||||
// no packed 32 bit (float) support for these legacy types
|
||||
|
||||
// RGB planar
|
||||
AVS_CS_RGBP = AVS_CS_GENERIC_RGBP | AVS_CS_SAMPLE_BITS_8, // Planar RGB 8 bit samples
|
||||
AVS_CS_RGBP10 = AVS_CS_GENERIC_RGBP | AVS_CS_SAMPLE_BITS_10, // Planar RGB 10bit samples
|
||||
AVS_CS_RGBP12 = AVS_CS_GENERIC_RGBP | AVS_CS_SAMPLE_BITS_12, // Planar RGB 12bit samples
|
||||
AVS_CS_RGBP14 = AVS_CS_GENERIC_RGBP | AVS_CS_SAMPLE_BITS_14, // Planar RGB 14bit samples
|
||||
AVS_CS_RGBP16 = AVS_CS_GENERIC_RGBP | AVS_CS_SAMPLE_BITS_16, // Planar RGB 16bit samples
|
||||
AVS_CS_RGBPS = AVS_CS_GENERIC_RGBP | AVS_CS_SAMPLE_BITS_32, // Planar RGB 32bit samples
|
||||
|
||||
// RGBA planar
|
||||
AVS_CS_RGBAP = AVS_CS_GENERIC_RGBAP | AVS_CS_SAMPLE_BITS_8, // Planar RGBA 8 bit samples
|
||||
AVS_CS_RGBAP10 = AVS_CS_GENERIC_RGBAP | AVS_CS_SAMPLE_BITS_10, // Planar RGBA 10bit samples
|
||||
AVS_CS_RGBAP12 = AVS_CS_GENERIC_RGBAP | AVS_CS_SAMPLE_BITS_12, // Planar RGBA 12bit samples
|
||||
AVS_CS_RGBAP14 = AVS_CS_GENERIC_RGBAP | AVS_CS_SAMPLE_BITS_14, // Planar RGBA 14bit samples
|
||||
AVS_CS_RGBAP16 = AVS_CS_GENERIC_RGBAP | AVS_CS_SAMPLE_BITS_16, // Planar RGBA 16bit samples
|
||||
AVS_CS_RGBAPS = AVS_CS_GENERIC_RGBAP | AVS_CS_SAMPLE_BITS_32, // Planar RGBA 32bit samples
|
||||
|
||||
// Planar YUVA
|
||||
AVS_CS_YUVA444 = AVS_CS_GENERIC_YUVA444 | AVS_CS_SAMPLE_BITS_8, // YUVA 4:4:4 8bit samples
|
||||
AVS_CS_YUVA422 = AVS_CS_GENERIC_YUVA422 | AVS_CS_SAMPLE_BITS_8, // YUVA 4:2:2 8bit samples
|
||||
AVS_CS_YUVA420 = AVS_CS_GENERIC_YUVA420 | AVS_CS_SAMPLE_BITS_8, // YUVA 4:2:0 8bit samples
|
||||
|
||||
AVS_CS_YUVA444P10 = AVS_CS_GENERIC_YUVA444 | AVS_CS_SAMPLE_BITS_10, // YUVA 4:4:4 10bit samples
|
||||
AVS_CS_YUVA422P10 = AVS_CS_GENERIC_YUVA422 | AVS_CS_SAMPLE_BITS_10, // YUVA 4:2:2 10bit samples
|
||||
AVS_CS_YUVA420P10 = AVS_CS_GENERIC_YUVA420 | AVS_CS_SAMPLE_BITS_10, // YUVA 4:2:0 10bit samples
|
||||
|
||||
AVS_CS_YUVA444P12 = AVS_CS_GENERIC_YUVA444 | AVS_CS_SAMPLE_BITS_12, // YUVA 4:4:4 12bit samples
|
||||
AVS_CS_YUVA422P12 = AVS_CS_GENERIC_YUVA422 | AVS_CS_SAMPLE_BITS_12, // YUVA 4:2:2 12bit samples
|
||||
AVS_CS_YUVA420P12 = AVS_CS_GENERIC_YUVA420 | AVS_CS_SAMPLE_BITS_12, // YUVA 4:2:0 12bit samples
|
||||
|
||||
AVS_CS_YUVA444P14 = AVS_CS_GENERIC_YUVA444 | AVS_CS_SAMPLE_BITS_14, // YUVA 4:4:4 14bit samples
|
||||
AVS_CS_YUVA422P14 = AVS_CS_GENERIC_YUVA422 | AVS_CS_SAMPLE_BITS_14, // YUVA 4:2:2 14bit samples
|
||||
AVS_CS_YUVA420P14 = AVS_CS_GENERIC_YUVA420 | AVS_CS_SAMPLE_BITS_14, // YUVA 4:2:0 14bit samples
|
||||
|
||||
AVS_CS_YUVA444P16 = AVS_CS_GENERIC_YUVA444 | AVS_CS_SAMPLE_BITS_16, // YUVA 4:4:4 16bit samples
|
||||
AVS_CS_YUVA422P16 = AVS_CS_GENERIC_YUVA422 | AVS_CS_SAMPLE_BITS_16, // YUVA 4:2:2 16bit samples
|
||||
AVS_CS_YUVA420P16 = AVS_CS_GENERIC_YUVA420 | AVS_CS_SAMPLE_BITS_16, // YUVA 4:2:0 16bit samples
|
||||
|
||||
AVS_CS_YUVA444PS = AVS_CS_GENERIC_YUVA444 | AVS_CS_SAMPLE_BITS_32, // YUVA 4:4:4 32bit samples
|
||||
AVS_CS_YUVA422PS = AVS_CS_GENERIC_YUVA422 | AVS_CS_SAMPLE_BITS_32, // YUVA 4:2:2 32bit samples
|
||||
AVS_CS_YUVA420PS = AVS_CS_GENERIC_YUVA420 | AVS_CS_SAMPLE_BITS_32, // YUVA 4:2:0 32bit samples
|
||||
|
||||
AVS_CS_Y8 = AVS_CS_PLANAR | AVS_CS_INTERLEAVED | AVS_CS_YUV | AVS_CS_SAMPLE_BITS_8 // Y 4:0:0 planar
|
||||
};
|
||||
|
||||
enum {
|
||||
@@ -342,10 +247,10 @@ AVSC_INLINE int avs_is_rgb(const AVS_VideoInfo * p)
|
||||
{ return !!(p->pixel_type&AVS_CS_BGR); }
|
||||
|
||||
AVSC_INLINE int avs_is_rgb24(const AVS_VideoInfo * p)
|
||||
{ return ((p->pixel_type&AVS_CS_BGR24)==AVS_CS_BGR24) && ((p->pixel_type & AVS_CS_SAMPLE_BITS_MASK) == AVS_CS_SAMPLE_BITS_8); }
|
||||
{ return (p->pixel_type&AVS_CS_BGR24)==AVS_CS_BGR24; } // Clear out additional properties
|
||||
|
||||
AVSC_INLINE int avs_is_rgb32(const AVS_VideoInfo * p)
|
||||
{ return ((p->pixel_type&AVS_CS_BGR32)==AVS_CS_BGR32) && ((p->pixel_type & AVS_CS_SAMPLE_BITS_MASK) == AVS_CS_SAMPLE_BITS_8); }
|
||||
{ return (p->pixel_type & AVS_CS_BGR32) == AVS_CS_BGR32 ; }
|
||||
|
||||
AVSC_INLINE int avs_is_yuv(const AVS_VideoInfo * p)
|
||||
{ return !!(p->pixel_type&AVS_CS_YUV ); }
|
||||
@@ -353,10 +258,6 @@ AVSC_INLINE int avs_is_yuv(const AVS_VideoInfo * p)
|
||||
AVSC_INLINE int avs_is_yuy2(const AVS_VideoInfo * p)
|
||||
{ return (p->pixel_type & AVS_CS_YUY2) == AVS_CS_YUY2; }
|
||||
|
||||
AVSC_API(int, avs_is_rgb48)(const AVS_VideoInfo * p);
|
||||
|
||||
AVSC_API(int, avs_is_rgb64)(const AVS_VideoInfo * p);
|
||||
|
||||
AVSC_API(int, avs_is_yv24)(const AVS_VideoInfo * p);
|
||||
|
||||
AVSC_API(int, avs_is_yv16)(const AVS_VideoInfo * p);
|
||||
@@ -367,38 +268,6 @@ AVSC_API(int, avs_is_yv411)(const AVS_VideoInfo * p);
|
||||
|
||||
AVSC_API(int, avs_is_y8)(const AVS_VideoInfo * p);
|
||||
|
||||
AVSC_API(int, avs_is_yuv444p16)(const AVS_VideoInfo * p);
|
||||
|
||||
AVSC_API(int, avs_is_yuv422p16)(const AVS_VideoInfo * p);
|
||||
|
||||
AVSC_API(int, avs_is_yuv420p16)(const AVS_VideoInfo * p);
|
||||
|
||||
AVSC_API(int, avs_is_y16)(const AVS_VideoInfo * p);
|
||||
|
||||
AVSC_API(int, avs_is_yuv444ps)(const AVS_VideoInfo * p);
|
||||
|
||||
AVSC_API(int, avs_is_yuv422ps)(const AVS_VideoInfo * p);
|
||||
|
||||
AVSC_API(int, avs_is_yuv420ps)(const AVS_VideoInfo * p);
|
||||
|
||||
AVSC_API(int, avs_is_y32)(const AVS_VideoInfo * p);
|
||||
|
||||
AVSC_API(int, avs_is_444)(const AVS_VideoInfo * p);
|
||||
|
||||
AVSC_API(int, avs_is_422)(const AVS_VideoInfo * p);
|
||||
|
||||
AVSC_API(int, avs_is_420)(const AVS_VideoInfo * p);
|
||||
|
||||
AVSC_API(int, avs_is_y)(const AVS_VideoInfo * p);
|
||||
|
||||
AVSC_API(int, avs_is_yuva)(const AVS_VideoInfo * p);
|
||||
|
||||
AVSC_API(int, avs_is_planar_rgb)(const AVS_VideoInfo * p);
|
||||
|
||||
AVSC_API(int, avs_is_planar_rgba)(const AVS_VideoInfo * p);
|
||||
|
||||
|
||||
|
||||
AVSC_INLINE int avs_is_property(const AVS_VideoInfo * p, int property)
|
||||
{ return ((p->image_type & property)==property ); }
|
||||
|
||||
@@ -496,12 +365,6 @@ AVSC_INLINE int avs_is_same_colorspace(AVS_VideoInfo * x, AVS_VideoInfo * y)
|
||||
}
|
||||
#endif
|
||||
|
||||
AVSC_API(int, avs_num_components)(const AVS_VideoInfo * p);
|
||||
|
||||
AVSC_API(int, avs_component_size)(const AVS_VideoInfo * p);
|
||||
|
||||
AVSC_API(int, avs_bits_per_component)(const AVS_VideoInfo * p);
|
||||
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// AVS_VideoFrame
|
||||
@@ -665,7 +528,7 @@ AVSC_INLINE AVS_Value avs_new_value_clip(AVS_Clip * v0)
|
||||
{ AVS_Value v; avs_set_to_clip(&v, v0); return v; }
|
||||
#endif
|
||||
AVSC_INLINE AVS_Value avs_new_value_array(AVS_Value * v0, int size)
|
||||
{ AVS_Value v; v.type = 'a'; v.d.array = v0; v.array_size = (short)size; return v; }
|
||||
{ AVS_Value v; v.type = 'a'; v.d.array = v0; v.array_size = size; return v; }
|
||||
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
@@ -898,28 +761,11 @@ struct AVS_Library {
|
||||
AVSC_DECLARE_FUNC(avs_vsprintf);
|
||||
|
||||
AVSC_DECLARE_FUNC(avs_get_error);
|
||||
AVSC_DECLARE_FUNC(avs_is_rgb48);
|
||||
AVSC_DECLARE_FUNC(avs_is_rgb64);
|
||||
AVSC_DECLARE_FUNC(avs_is_yv24);
|
||||
AVSC_DECLARE_FUNC(avs_is_yv16);
|
||||
AVSC_DECLARE_FUNC(avs_is_yv12);
|
||||
AVSC_DECLARE_FUNC(avs_is_yv411);
|
||||
AVSC_DECLARE_FUNC(avs_is_y8);
|
||||
AVSC_DECLARE_FUNC(avs_is_yuv444p16);
|
||||
AVSC_DECLARE_FUNC(avs_is_yuv422p16);
|
||||
AVSC_DECLARE_FUNC(avs_is_yuv420p16);
|
||||
AVSC_DECLARE_FUNC(avs_is_y16);
|
||||
AVSC_DECLARE_FUNC(avs_is_yuv444ps);
|
||||
AVSC_DECLARE_FUNC(avs_is_yuv422ps);
|
||||
AVSC_DECLARE_FUNC(avs_is_yuv420ps);
|
||||
AVSC_DECLARE_FUNC(avs_is_y32);
|
||||
AVSC_DECLARE_FUNC(avs_is_444);
|
||||
AVSC_DECLARE_FUNC(avs_is_422);
|
||||
AVSC_DECLARE_FUNC(avs_is_420);
|
||||
AVSC_DECLARE_FUNC(avs_is_y);
|
||||
AVSC_DECLARE_FUNC(avs_is_yuva);
|
||||
AVSC_DECLARE_FUNC(avs_is_planar_rgb);
|
||||
AVSC_DECLARE_FUNC(avs_is_planar_rgba);
|
||||
AVSC_DECLARE_FUNC(avs_is_color_space);
|
||||
|
||||
AVSC_DECLARE_FUNC(avs_get_plane_width_subsampling);
|
||||
@@ -934,11 +780,6 @@ struct AVS_Library {
|
||||
AVSC_DECLARE_FUNC(avs_get_read_ptr_p);
|
||||
AVSC_DECLARE_FUNC(avs_is_writable);
|
||||
AVSC_DECLARE_FUNC(avs_get_write_ptr_p);
|
||||
|
||||
AVSC_DECLARE_FUNC(avs_num_components);
|
||||
AVSC_DECLARE_FUNC(avs_component_size);
|
||||
AVSC_DECLARE_FUNC(avs_bits_per_component);
|
||||
|
||||
};
|
||||
|
||||
#undef AVSC_DECLARE_FUNC
|
||||
@@ -999,28 +840,11 @@ AVSC_INLINE AVS_Library * avs_load_library() {
|
||||
AVSC_LOAD_FUNC(avs_vsprintf);
|
||||
|
||||
AVSC_LOAD_FUNC(avs_get_error);
|
||||
AVSC_LOAD_FUNC(avs_is_rgb48);
|
||||
AVSC_LOAD_FUNC(avs_is_rgb64);
|
||||
AVSC_LOAD_FUNC(avs_is_yv24);
|
||||
AVSC_LOAD_FUNC(avs_is_yv16);
|
||||
AVSC_LOAD_FUNC(avs_is_yv12);
|
||||
AVSC_LOAD_FUNC(avs_is_yv411);
|
||||
AVSC_LOAD_FUNC(avs_is_y8);
|
||||
AVSC_LOAD_FUNC(avs_is_yuv444p16);
|
||||
AVSC_LOAD_FUNC(avs_is_yuv422p16);
|
||||
AVSC_LOAD_FUNC(avs_is_yuv420p16);
|
||||
AVSC_LOAD_FUNC(avs_is_y16);
|
||||
AVSC_LOAD_FUNC(avs_is_yuv444ps);
|
||||
AVSC_LOAD_FUNC(avs_is_yuv422ps);
|
||||
AVSC_LOAD_FUNC(avs_is_yuv420ps);
|
||||
AVSC_LOAD_FUNC(avs_is_y32);
|
||||
AVSC_LOAD_FUNC(avs_is_444);
|
||||
AVSC_LOAD_FUNC(avs_is_422);
|
||||
AVSC_LOAD_FUNC(avs_is_420);
|
||||
AVSC_LOAD_FUNC(avs_is_y);
|
||||
AVSC_LOAD_FUNC(avs_is_yuva);
|
||||
AVSC_LOAD_FUNC(avs_is_planar_rgb);
|
||||
AVSC_LOAD_FUNC(avs_is_planar_rgba);
|
||||
AVSC_LOAD_FUNC(avs_is_color_space);
|
||||
|
||||
AVSC_LOAD_FUNC(avs_get_plane_width_subsampling);
|
||||
@@ -1036,12 +860,6 @@ AVSC_INLINE AVS_Library * avs_load_library() {
|
||||
AVSC_LOAD_FUNC(avs_is_writable);
|
||||
AVSC_LOAD_FUNC(avs_get_write_ptr_p);
|
||||
|
||||
AVSC_LOAD_FUNC(avs_num_components);
|
||||
AVSC_LOAD_FUNC(avs_component_size);
|
||||
AVSC_LOAD_FUNC(avs_bits_per_component);
|
||||
|
||||
|
||||
|
||||
#undef __AVSC_STRINGIFY
|
||||
#undef AVSC_STRINGIFY
|
||||
#undef AVSC_LOAD_FUNC
|
||||
|
||||
@@ -1,827 +0,0 @@
|
||||
/*
|
||||
* This copyright notice applies to this header file only:
|
||||
*
|
||||
* Copyright (c) 2010-2016 NVIDIA Corporation
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file cuviddec.h
|
||||
* NvCuvid API provides Video Decoding interface to NVIDIA GPU devices.
|
||||
* \date 2015-2016
|
||||
* This file contains constants, structure definitions and function prototypes used for decoding.
|
||||
*/
|
||||
|
||||
#if !defined(__CUDA_VIDEO_H__)
|
||||
#define __CUDA_VIDEO_H__
|
||||
|
||||
#ifndef __cuda_cuda_h__
|
||||
#include <cuda.h>
|
||||
#endif // __cuda_cuda_h__
|
||||
|
||||
#if defined(__x86_64) || defined(AMD64) || defined(_M_AMD64)
|
||||
#if (CUDA_VERSION >= 3020) && (!defined(CUDA_FORCE_API_VERSION) || (CUDA_FORCE_API_VERSION >= 3020))
|
||||
#define __CUVID_DEVPTR64
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
typedef void *CUvideodecoder;
|
||||
typedef struct _CUcontextlock_st *CUvideoctxlock;
|
||||
|
||||
/**
|
||||
* \addtogroup VIDEO_DECODER Video Decoder
|
||||
* @{
|
||||
*/
|
||||
|
||||
/*!
|
||||
* \enum cudaVideoCodec
|
||||
* Video Codec Enums
|
||||
*/
|
||||
typedef enum cudaVideoCodec_enum {
|
||||
cudaVideoCodec_MPEG1=0, /**< MPEG1 */
|
||||
cudaVideoCodec_MPEG2, /**< MPEG2 */
|
||||
cudaVideoCodec_MPEG4, /**< MPEG4 */
|
||||
cudaVideoCodec_VC1, /**< VC1 */
|
||||
cudaVideoCodec_H264, /**< H264 */
|
||||
cudaVideoCodec_JPEG, /**< JPEG */
|
||||
cudaVideoCodec_H264_SVC, /**< H264-SVC */
|
||||
cudaVideoCodec_H264_MVC, /**< H264-MVC */
|
||||
cudaVideoCodec_HEVC, /**< HEVC */
|
||||
cudaVideoCodec_VP8, /**< VP8 */
|
||||
cudaVideoCodec_VP9, /**< VP9 */
|
||||
cudaVideoCodec_NumCodecs, /**< Max COdecs */
|
||||
// Uncompressed YUV
|
||||
cudaVideoCodec_YUV420 = (('I'<<24)|('Y'<<16)|('U'<<8)|('V')), /**< Y,U,V (4:2:0) */
|
||||
cudaVideoCodec_YV12 = (('Y'<<24)|('V'<<16)|('1'<<8)|('2')), /**< Y,V,U (4:2:0) */
|
||||
cudaVideoCodec_NV12 = (('N'<<24)|('V'<<16)|('1'<<8)|('2')), /**< Y,UV (4:2:0) */
|
||||
cudaVideoCodec_YUYV = (('Y'<<24)|('U'<<16)|('Y'<<8)|('V')), /**< YUYV/YUY2 (4:2:2) */
|
||||
cudaVideoCodec_UYVY = (('U'<<24)|('Y'<<16)|('V'<<8)|('Y')) /**< UYVY (4:2:2) */
|
||||
} cudaVideoCodec;
|
||||
|
||||
/*!
|
||||
* \enum cudaVideoSurfaceFormat
|
||||
* Video Surface Formats Enums
|
||||
*/
|
||||
typedef enum cudaVideoSurfaceFormat_enum {
|
||||
cudaVideoSurfaceFormat_NV12=0 /**< NV12 (currently the only supported output format) */
|
||||
} cudaVideoSurfaceFormat;
|
||||
|
||||
/*!
|
||||
* \enum cudaVideoDeinterlaceMode
|
||||
* Deinterlacing Modes Enums
|
||||
*/
|
||||
typedef enum cudaVideoDeinterlaceMode_enum {
|
||||
cudaVideoDeinterlaceMode_Weave=0, /**< Weave both fields (no deinterlacing) */
|
||||
cudaVideoDeinterlaceMode_Bob, /**< Drop one field */
|
||||
cudaVideoDeinterlaceMode_Adaptive /**< Adaptive deinterlacing */
|
||||
} cudaVideoDeinterlaceMode;
|
||||
|
||||
/*!
|
||||
* \enum cudaVideoChromaFormat
|
||||
* Chroma Formats Enums
|
||||
*/
|
||||
typedef enum cudaVideoChromaFormat_enum {
|
||||
cudaVideoChromaFormat_Monochrome=0, /**< MonoChrome */
|
||||
cudaVideoChromaFormat_420, /**< 4:2:0 */
|
||||
cudaVideoChromaFormat_422, /**< 4:2:2 */
|
||||
cudaVideoChromaFormat_444 /**< 4:4:4 */
|
||||
} cudaVideoChromaFormat;
|
||||
|
||||
/*!
|
||||
* \enum cudaVideoCreateFlags
|
||||
* Decoder Flags Enums
|
||||
*/
|
||||
typedef enum cudaVideoCreateFlags_enum {
|
||||
cudaVideoCreate_Default = 0x00, /**< Default operation mode: use dedicated video engines */
|
||||
cudaVideoCreate_PreferCUDA = 0x01, /**< Use a CUDA-based decoder if faster than dedicated engines (requires a valid vidLock object for multi-threading) */
|
||||
cudaVideoCreate_PreferDXVA = 0x02, /**< Go through DXVA internally if possible (requires D3D9 interop) */
|
||||
cudaVideoCreate_PreferCUVID = 0x04 /**< Use dedicated video engines directly */
|
||||
} cudaVideoCreateFlags;
|
||||
|
||||
/*!
|
||||
* \struct CUVIDDECODECREATEINFO
|
||||
* Struct used in create decoder
|
||||
*/
|
||||
typedef struct _CUVIDDECODECREATEINFO
|
||||
{
|
||||
unsigned long ulWidth; /**< Coded Sequence Width */
|
||||
unsigned long ulHeight; /**< Coded Sequence Height */
|
||||
unsigned long ulNumDecodeSurfaces; /**< Maximum number of internal decode surfaces */
|
||||
cudaVideoCodec CodecType; /**< cudaVideoCodec_XXX */
|
||||
cudaVideoChromaFormat ChromaFormat; /**< cudaVideoChromaFormat_XXX (only 4:2:0 is currently supported) */
|
||||
unsigned long ulCreationFlags; /**< Decoder creation flags (cudaVideoCreateFlags_XXX) */
|
||||
unsigned long bitDepthMinus8;
|
||||
unsigned long Reserved1[4]; /**< Reserved for future use - set to zero */
|
||||
/**
|
||||
* area of the frame that should be displayed
|
||||
*/
|
||||
struct {
|
||||
short left;
|
||||
short top;
|
||||
short right;
|
||||
short bottom;
|
||||
} display_area;
|
||||
|
||||
cudaVideoSurfaceFormat OutputFormat; /**< cudaVideoSurfaceFormat_XXX */
|
||||
cudaVideoDeinterlaceMode DeinterlaceMode; /**< cudaVideoDeinterlaceMode_XXX */
|
||||
unsigned long ulTargetWidth; /**< Post-processed Output Width (Should be aligned to 2) */
|
||||
unsigned long ulTargetHeight; /**< Post-processed Output Height (Should be aligbed to 2) */
|
||||
unsigned long ulNumOutputSurfaces; /**< Maximum number of output surfaces simultaneously mapped */
|
||||
CUvideoctxlock vidLock; /**< If non-NULL, context lock used for synchronizing ownership of the cuda context */
|
||||
/**
|
||||
* target rectangle in the output frame (for aspect ratio conversion)
|
||||
* if a null rectangle is specified, {0,0,ulTargetWidth,ulTargetHeight} will be used
|
||||
*/
|
||||
struct {
|
||||
short left;
|
||||
short top;
|
||||
short right;
|
||||
short bottom;
|
||||
} target_rect;
|
||||
unsigned long Reserved2[5]; /**< Reserved for future use - set to zero */
|
||||
} CUVIDDECODECREATEINFO;
|
||||
|
||||
/*!
|
||||
* \struct CUVIDH264DPBENTRY
|
||||
* H.264 DPB Entry
|
||||
*/
|
||||
typedef struct _CUVIDH264DPBENTRY
|
||||
{
|
||||
int PicIdx; /**< picture index of reference frame */
|
||||
int FrameIdx; /**< frame_num(short-term) or LongTermFrameIdx(long-term) */
|
||||
int is_long_term; /**< 0=short term reference, 1=long term reference */
|
||||
int not_existing; /**< non-existing reference frame (corresponding PicIdx should be set to -1) */
|
||||
int used_for_reference; /**< 0=unused, 1=top_field, 2=bottom_field, 3=both_fields */
|
||||
int FieldOrderCnt[2]; /**< field order count of top and bottom fields */
|
||||
} CUVIDH264DPBENTRY;
|
||||
|
||||
/*!
|
||||
* \struct CUVIDH264MVCEXT
|
||||
* H.264 MVC Picture Parameters Ext
|
||||
*/
|
||||
typedef struct _CUVIDH264MVCEXT
|
||||
{
|
||||
int num_views_minus1;
|
||||
int view_id;
|
||||
unsigned char inter_view_flag;
|
||||
unsigned char num_inter_view_refs_l0;
|
||||
unsigned char num_inter_view_refs_l1;
|
||||
unsigned char MVCReserved8Bits;
|
||||
int InterViewRefsL0[16];
|
||||
int InterViewRefsL1[16];
|
||||
} CUVIDH264MVCEXT;
|
||||
|
||||
/*!
|
||||
* \struct CUVIDH264SVCEXT
|
||||
* H.264 SVC Picture Parameters Ext
|
||||
*/
|
||||
typedef struct _CUVIDH264SVCEXT
|
||||
{
|
||||
unsigned char profile_idc;
|
||||
unsigned char level_idc;
|
||||
unsigned char DQId;
|
||||
unsigned char DQIdMax;
|
||||
unsigned char disable_inter_layer_deblocking_filter_idc;
|
||||
unsigned char ref_layer_chroma_phase_y_plus1;
|
||||
signed char inter_layer_slice_alpha_c0_offset_div2;
|
||||
signed char inter_layer_slice_beta_offset_div2;
|
||||
|
||||
unsigned short DPBEntryValidFlag;
|
||||
unsigned char inter_layer_deblocking_filter_control_present_flag;
|
||||
unsigned char extended_spatial_scalability_idc;
|
||||
unsigned char adaptive_tcoeff_level_prediction_flag;
|
||||
unsigned char slice_header_restriction_flag;
|
||||
unsigned char chroma_phase_x_plus1_flag;
|
||||
unsigned char chroma_phase_y_plus1;
|
||||
|
||||
unsigned char tcoeff_level_prediction_flag;
|
||||
unsigned char constrained_intra_resampling_flag;
|
||||
unsigned char ref_layer_chroma_phase_x_plus1_flag;
|
||||
unsigned char store_ref_base_pic_flag;
|
||||
unsigned char Reserved8BitsA;
|
||||
unsigned char Reserved8BitsB;
|
||||
// For the 4 scaled_ref_layer_XX fields below,
|
||||
// if (extended_spatial_scalability_idc == 1), SPS field, G.7.3.2.1.4, add prefix "seq_"
|
||||
// if (extended_spatial_scalability_idc == 2), SLH field, G.7.3.3.4,
|
||||
short scaled_ref_layer_left_offset;
|
||||
short scaled_ref_layer_top_offset;
|
||||
short scaled_ref_layer_right_offset;
|
||||
short scaled_ref_layer_bottom_offset;
|
||||
unsigned short Reserved16Bits;
|
||||
struct _CUVIDPICPARAMS *pNextLayer; /**< Points to the picparams for the next layer to be decoded. Linked list ends at the target layer. */
|
||||
int bRefBaseLayer; /**< whether to store ref base pic */
|
||||
} CUVIDH264SVCEXT;
|
||||
|
||||
/*!
|
||||
* \struct CUVIDH264PICPARAMS
|
||||
* H.264 Picture Parameters
|
||||
*/
|
||||
typedef struct _CUVIDH264PICPARAMS
|
||||
{
|
||||
// SPS
|
||||
int log2_max_frame_num_minus4;
|
||||
int pic_order_cnt_type;
|
||||
int log2_max_pic_order_cnt_lsb_minus4;
|
||||
int delta_pic_order_always_zero_flag;
|
||||
int frame_mbs_only_flag;
|
||||
int direct_8x8_inference_flag;
|
||||
int num_ref_frames; // NOTE: shall meet level 4.1 restrictions
|
||||
unsigned char residual_colour_transform_flag;
|
||||
unsigned char bit_depth_luma_minus8; // Must be 0 (only 8-bit supported)
|
||||
unsigned char bit_depth_chroma_minus8; // Must be 0 (only 8-bit supported)
|
||||
unsigned char qpprime_y_zero_transform_bypass_flag;
|
||||
// PPS
|
||||
int entropy_coding_mode_flag;
|
||||
int pic_order_present_flag;
|
||||
int num_ref_idx_l0_active_minus1;
|
||||
int num_ref_idx_l1_active_minus1;
|
||||
int weighted_pred_flag;
|
||||
int weighted_bipred_idc;
|
||||
int pic_init_qp_minus26;
|
||||
int deblocking_filter_control_present_flag;
|
||||
int redundant_pic_cnt_present_flag;
|
||||
int transform_8x8_mode_flag;
|
||||
int MbaffFrameFlag;
|
||||
int constrained_intra_pred_flag;
|
||||
int chroma_qp_index_offset;
|
||||
int second_chroma_qp_index_offset;
|
||||
int ref_pic_flag;
|
||||
int frame_num;
|
||||
int CurrFieldOrderCnt[2];
|
||||
// DPB
|
||||
CUVIDH264DPBENTRY dpb[16]; // List of reference frames within the DPB
|
||||
// Quantization Matrices (raster-order)
|
||||
unsigned char WeightScale4x4[6][16];
|
||||
unsigned char WeightScale8x8[2][64];
|
||||
// FMO/ASO
|
||||
unsigned char fmo_aso_enable;
|
||||
unsigned char num_slice_groups_minus1;
|
||||
unsigned char slice_group_map_type;
|
||||
signed char pic_init_qs_minus26;
|
||||
unsigned int slice_group_change_rate_minus1;
|
||||
union
|
||||
{
|
||||
unsigned long long slice_group_map_addr;
|
||||
const unsigned char *pMb2SliceGroupMap;
|
||||
} fmo;
|
||||
unsigned int Reserved[12];
|
||||
// SVC/MVC
|
||||
union
|
||||
{
|
||||
CUVIDH264MVCEXT mvcext;
|
||||
CUVIDH264SVCEXT svcext;
|
||||
};
|
||||
} CUVIDH264PICPARAMS;
|
||||
|
||||
|
||||
/*!
|
||||
* \struct CUVIDMPEG2PICPARAMS
|
||||
* MPEG-2 Picture Parameters
|
||||
*/
|
||||
typedef struct _CUVIDMPEG2PICPARAMS
|
||||
{
|
||||
int ForwardRefIdx; // Picture index of forward reference (P/B-frames)
|
||||
int BackwardRefIdx; // Picture index of backward reference (B-frames)
|
||||
int picture_coding_type;
|
||||
int full_pel_forward_vector;
|
||||
int full_pel_backward_vector;
|
||||
int f_code[2][2];
|
||||
int intra_dc_precision;
|
||||
int frame_pred_frame_dct;
|
||||
int concealment_motion_vectors;
|
||||
int q_scale_type;
|
||||
int intra_vlc_format;
|
||||
int alternate_scan;
|
||||
int top_field_first;
|
||||
// Quantization matrices (raster order)
|
||||
unsigned char QuantMatrixIntra[64];
|
||||
unsigned char QuantMatrixInter[64];
|
||||
} CUVIDMPEG2PICPARAMS;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// MPEG-4 Picture Parameters
|
||||
//
|
||||
|
||||
// MPEG-4 has VOP types instead of Picture types
|
||||
#define I_VOP 0
|
||||
#define P_VOP 1
|
||||
#define B_VOP 2
|
||||
#define S_VOP 3
|
||||
|
||||
/*!
|
||||
* \struct CUVIDMPEG4PICPARAMS
|
||||
* MPEG-4 Picture Parameters
|
||||
*/
|
||||
typedef struct _CUVIDMPEG4PICPARAMS
|
||||
{
|
||||
int ForwardRefIdx; // Picture index of forward reference (P/B-frames)
|
||||
int BackwardRefIdx; // Picture index of backward reference (B-frames)
|
||||
// VOL
|
||||
int video_object_layer_width;
|
||||
int video_object_layer_height;
|
||||
int vop_time_increment_bitcount;
|
||||
int top_field_first;
|
||||
int resync_marker_disable;
|
||||
int quant_type;
|
||||
int quarter_sample;
|
||||
int short_video_header;
|
||||
int divx_flags;
|
||||
// VOP
|
||||
int vop_coding_type;
|
||||
int vop_coded;
|
||||
int vop_rounding_type;
|
||||
int alternate_vertical_scan_flag;
|
||||
int interlaced;
|
||||
int vop_fcode_forward;
|
||||
int vop_fcode_backward;
|
||||
int trd[2];
|
||||
int trb[2];
|
||||
// Quantization matrices (raster order)
|
||||
unsigned char QuantMatrixIntra[64];
|
||||
unsigned char QuantMatrixInter[64];
|
||||
int gmc_enabled;
|
||||
} CUVIDMPEG4PICPARAMS;
|
||||
|
||||
/*!
|
||||
* \struct CUVIDVC1PICPARAMS
|
||||
* VC1 Picture Parameters
|
||||
*/
|
||||
typedef struct _CUVIDVC1PICPARAMS
|
||||
{
|
||||
int ForwardRefIdx; /**< Picture index of forward reference (P/B-frames) */
|
||||
int BackwardRefIdx; /**< Picture index of backward reference (B-frames) */
|
||||
int FrameWidth; /**< Actual frame width */
|
||||
int FrameHeight; /**< Actual frame height */
|
||||
// PICTURE
|
||||
int intra_pic_flag; /**< Set to 1 for I,BI frames */
|
||||
int ref_pic_flag; /**< Set to 1 for I,P frames */
|
||||
int progressive_fcm; /**< Progressive frame */
|
||||
// SEQUENCE
|
||||
int profile;
|
||||
int postprocflag;
|
||||
int pulldown;
|
||||
int interlace;
|
||||
int tfcntrflag;
|
||||
int finterpflag;
|
||||
int psf;
|
||||
int multires;
|
||||
int syncmarker;
|
||||
int rangered;
|
||||
int maxbframes;
|
||||
// ENTRYPOINT
|
||||
int panscan_flag;
|
||||
int refdist_flag;
|
||||
int extended_mv;
|
||||
int dquant;
|
||||
int vstransform;
|
||||
int loopfilter;
|
||||
int fastuvmc;
|
||||
int overlap;
|
||||
int quantizer;
|
||||
int extended_dmv;
|
||||
int range_mapy_flag;
|
||||
int range_mapy;
|
||||
int range_mapuv_flag;
|
||||
int range_mapuv;
|
||||
int rangeredfrm; // range reduction state
|
||||
} CUVIDVC1PICPARAMS;
|
||||
|
||||
/*!
|
||||
* \struct CUVIDJPEGPICPARAMS
|
||||
* JPEG Picture Parameters
|
||||
*/
|
||||
typedef struct _CUVIDJPEGPICPARAMS
|
||||
{
|
||||
int Reserved;
|
||||
} CUVIDJPEGPICPARAMS;
|
||||
|
||||
|
||||
/*!
|
||||
* \struct CUVIDHEVCPICPARAMS
|
||||
* HEVC Picture Parameters
|
||||
*/
|
||||
typedef struct _CUVIDHEVCPICPARAMS
|
||||
{
|
||||
// sps
|
||||
int pic_width_in_luma_samples;
|
||||
int pic_height_in_luma_samples;
|
||||
unsigned char log2_min_luma_coding_block_size_minus3;
|
||||
unsigned char log2_diff_max_min_luma_coding_block_size;
|
||||
unsigned char log2_min_transform_block_size_minus2;
|
||||
unsigned char log2_diff_max_min_transform_block_size;
|
||||
unsigned char pcm_enabled_flag;
|
||||
unsigned char log2_min_pcm_luma_coding_block_size_minus3;
|
||||
unsigned char log2_diff_max_min_pcm_luma_coding_block_size;
|
||||
unsigned char pcm_sample_bit_depth_luma_minus1;
|
||||
|
||||
unsigned char pcm_sample_bit_depth_chroma_minus1;
|
||||
unsigned char pcm_loop_filter_disabled_flag;
|
||||
unsigned char strong_intra_smoothing_enabled_flag;
|
||||
unsigned char max_transform_hierarchy_depth_intra;
|
||||
unsigned char max_transform_hierarchy_depth_inter;
|
||||
unsigned char amp_enabled_flag;
|
||||
unsigned char separate_colour_plane_flag;
|
||||
unsigned char log2_max_pic_order_cnt_lsb_minus4;
|
||||
|
||||
unsigned char num_short_term_ref_pic_sets;
|
||||
unsigned char long_term_ref_pics_present_flag;
|
||||
unsigned char num_long_term_ref_pics_sps;
|
||||
unsigned char sps_temporal_mvp_enabled_flag;
|
||||
unsigned char sample_adaptive_offset_enabled_flag;
|
||||
unsigned char scaling_list_enable_flag;
|
||||
unsigned char IrapPicFlag;
|
||||
unsigned char IdrPicFlag;
|
||||
|
||||
unsigned char bit_depth_luma_minus8;
|
||||
unsigned char bit_depth_chroma_minus8;
|
||||
unsigned char reserved1[14];
|
||||
|
||||
// pps
|
||||
unsigned char dependent_slice_segments_enabled_flag;
|
||||
unsigned char slice_segment_header_extension_present_flag;
|
||||
unsigned char sign_data_hiding_enabled_flag;
|
||||
unsigned char cu_qp_delta_enabled_flag;
|
||||
unsigned char diff_cu_qp_delta_depth;
|
||||
signed char init_qp_minus26;
|
||||
signed char pps_cb_qp_offset;
|
||||
signed char pps_cr_qp_offset;
|
||||
|
||||
unsigned char constrained_intra_pred_flag;
|
||||
unsigned char weighted_pred_flag;
|
||||
unsigned char weighted_bipred_flag;
|
||||
unsigned char transform_skip_enabled_flag;
|
||||
unsigned char transquant_bypass_enabled_flag;
|
||||
unsigned char entropy_coding_sync_enabled_flag;
|
||||
unsigned char log2_parallel_merge_level_minus2;
|
||||
unsigned char num_extra_slice_header_bits;
|
||||
|
||||
unsigned char loop_filter_across_tiles_enabled_flag;
|
||||
unsigned char loop_filter_across_slices_enabled_flag;
|
||||
unsigned char output_flag_present_flag;
|
||||
unsigned char num_ref_idx_l0_default_active_minus1;
|
||||
unsigned char num_ref_idx_l1_default_active_minus1;
|
||||
unsigned char lists_modification_present_flag;
|
||||
unsigned char cabac_init_present_flag;
|
||||
unsigned char pps_slice_chroma_qp_offsets_present_flag;
|
||||
|
||||
unsigned char deblocking_filter_override_enabled_flag;
|
||||
unsigned char pps_deblocking_filter_disabled_flag;
|
||||
signed char pps_beta_offset_div2;
|
||||
signed char pps_tc_offset_div2;
|
||||
unsigned char tiles_enabled_flag;
|
||||
unsigned char uniform_spacing_flag;
|
||||
unsigned char num_tile_columns_minus1;
|
||||
unsigned char num_tile_rows_minus1;
|
||||
|
||||
unsigned short column_width_minus1[21];
|
||||
unsigned short row_height_minus1[21];
|
||||
unsigned int reserved3[15];
|
||||
|
||||
// RefPicSets
|
||||
int NumBitsForShortTermRPSInSlice;
|
||||
int NumDeltaPocsOfRefRpsIdx;
|
||||
int NumPocTotalCurr;
|
||||
int NumPocStCurrBefore;
|
||||
int NumPocStCurrAfter;
|
||||
int NumPocLtCurr;
|
||||
int CurrPicOrderCntVal;
|
||||
int RefPicIdx[16]; // [refpic] Indices of valid reference pictures (-1 if unused for reference)
|
||||
int PicOrderCntVal[16]; // [refpic]
|
||||
unsigned char IsLongTerm[16]; // [refpic] 0=not a long-term reference, 1=long-term reference
|
||||
unsigned char RefPicSetStCurrBefore[8]; // [0..NumPocStCurrBefore-1] -> refpic (0..15)
|
||||
unsigned char RefPicSetStCurrAfter[8]; // [0..NumPocStCurrAfter-1] -> refpic (0..15)
|
||||
unsigned char RefPicSetLtCurr[8]; // [0..NumPocLtCurr-1] -> refpic (0..15)
|
||||
unsigned char RefPicSetInterLayer0[8];
|
||||
unsigned char RefPicSetInterLayer1[8];
|
||||
unsigned int reserved4[12];
|
||||
|
||||
// scaling lists (diag order)
|
||||
unsigned char ScalingList4x4[6][16]; // [matrixId][i]
|
||||
unsigned char ScalingList8x8[6][64]; // [matrixId][i]
|
||||
unsigned char ScalingList16x16[6][64]; // [matrixId][i]
|
||||
unsigned char ScalingList32x32[2][64]; // [matrixId][i]
|
||||
unsigned char ScalingListDCCoeff16x16[6]; // [matrixId]
|
||||
unsigned char ScalingListDCCoeff32x32[2]; // [matrixId]
|
||||
} CUVIDHEVCPICPARAMS;
|
||||
|
||||
|
||||
/*!
|
||||
* \struct CUVIDVP8PICPARAMS
|
||||
* VP8 Picture Parameters
|
||||
*/
|
||||
typedef struct _CUVIDVP8PICPARAMS
|
||||
{
|
||||
int width;
|
||||
int height;
|
||||
unsigned int first_partition_size;
|
||||
//Frame Indexes
|
||||
unsigned char LastRefIdx;
|
||||
unsigned char GoldenRefIdx;
|
||||
unsigned char AltRefIdx;
|
||||
union {
|
||||
struct {
|
||||
unsigned char frame_type : 1; /**< 0 = KEYFRAME, 1 = INTERFRAME */
|
||||
unsigned char version : 3;
|
||||
unsigned char show_frame : 1;
|
||||
unsigned char update_mb_segmentation_data : 1; /**< Must be 0 if segmentation is not enabled */
|
||||
unsigned char Reserved2Bits : 2;
|
||||
};
|
||||
unsigned char wFrameTagFlags;
|
||||
};
|
||||
unsigned char Reserved1[4];
|
||||
unsigned int Reserved2[3];
|
||||
} CUVIDVP8PICPARAMS;
|
||||
|
||||
/*!
|
||||
* \struct CUVIDVP9PICPARAMS
|
||||
* VP9 Picture Parameters
|
||||
*/
|
||||
typedef struct _CUVIDVP9PICPARAMS
|
||||
{
|
||||
unsigned int width;
|
||||
unsigned int height;
|
||||
|
||||
//Frame Indices
|
||||
unsigned char LastRefIdx;
|
||||
unsigned char GoldenRefIdx;
|
||||
unsigned char AltRefIdx;
|
||||
unsigned char colorSpace;
|
||||
|
||||
unsigned short profile : 3;
|
||||
unsigned short frameContextIdx : 2;
|
||||
unsigned short frameType : 1;
|
||||
unsigned short showFrame : 1;
|
||||
unsigned short errorResilient : 1;
|
||||
unsigned short frameParallelDecoding : 1;
|
||||
unsigned short subSamplingX : 1;
|
||||
unsigned short subSamplingY : 1;
|
||||
unsigned short intraOnly : 1;
|
||||
unsigned short allow_high_precision_mv : 1;
|
||||
unsigned short refreshEntropyProbs : 1;
|
||||
unsigned short reserved2Bits : 2;
|
||||
|
||||
unsigned short reserved16Bits;
|
||||
|
||||
unsigned char refFrameSignBias[4];
|
||||
|
||||
unsigned char bitDepthMinus8Luma;
|
||||
unsigned char bitDepthMinus8Chroma;
|
||||
unsigned char loopFilterLevel;
|
||||
unsigned char loopFilterSharpness;
|
||||
|
||||
unsigned char modeRefLfEnabled;
|
||||
unsigned char log2_tile_columns;
|
||||
unsigned char log2_tile_rows;
|
||||
|
||||
unsigned char segmentEnabled : 1;
|
||||
unsigned char segmentMapUpdate : 1;
|
||||
unsigned char segmentMapTemporalUpdate : 1;
|
||||
unsigned char segmentFeatureMode : 1;
|
||||
unsigned char reserved4Bits : 4;
|
||||
|
||||
|
||||
unsigned char segmentFeatureEnable[8][4];
|
||||
short segmentFeatureData[8][4];
|
||||
unsigned char mb_segment_tree_probs[7];
|
||||
unsigned char segment_pred_probs[3];
|
||||
unsigned char reservedSegment16Bits[2];
|
||||
|
||||
int qpYAc;
|
||||
int qpYDc;
|
||||
int qpChDc;
|
||||
int qpChAc;
|
||||
|
||||
unsigned int activeRefIdx[3];
|
||||
unsigned int resetFrameContext;
|
||||
unsigned int mcomp_filter_type;
|
||||
unsigned int mbRefLfDelta[4];
|
||||
unsigned int mbModeLfDelta[2];
|
||||
unsigned int frameTagSize;
|
||||
unsigned int offsetToDctParts;
|
||||
unsigned int reserved128Bits[4];
|
||||
|
||||
} CUVIDVP9PICPARAMS;
|
||||
|
||||
|
||||
/*!
|
||||
* \struct CUVIDPICPARAMS
|
||||
* Picture Parameters for Decoding
|
||||
*/
|
||||
typedef struct _CUVIDPICPARAMS
|
||||
{
|
||||
int PicWidthInMbs; /**< Coded Frame Size */
|
||||
int FrameHeightInMbs; /**< Coded Frame Height */
|
||||
int CurrPicIdx; /**< Output index of the current picture */
|
||||
int field_pic_flag; /**< 0=frame picture, 1=field picture */
|
||||
int bottom_field_flag; /**< 0=top field, 1=bottom field (ignored if field_pic_flag=0) */
|
||||
int second_field; /**< Second field of a complementary field pair */
|
||||
// Bitstream data
|
||||
unsigned int nBitstreamDataLen; /**< Number of bytes in bitstream data buffer */
|
||||
const unsigned char *pBitstreamData; /**< Ptr to bitstream data for this picture (slice-layer) */
|
||||
unsigned int nNumSlices; /**< Number of slices in this picture */
|
||||
const unsigned int *pSliceDataOffsets; /**< nNumSlices entries, contains offset of each slice within the bitstream data buffer */
|
||||
int ref_pic_flag; /**< This picture is a reference picture */
|
||||
int intra_pic_flag; /**< This picture is entirely intra coded */
|
||||
unsigned int Reserved[30]; /**< Reserved for future use */
|
||||
// Codec-specific data
|
||||
union {
|
||||
CUVIDMPEG2PICPARAMS mpeg2; /**< Also used for MPEG-1 */
|
||||
CUVIDH264PICPARAMS h264;
|
||||
CUVIDVC1PICPARAMS vc1;
|
||||
CUVIDMPEG4PICPARAMS mpeg4;
|
||||
CUVIDJPEGPICPARAMS jpeg;
|
||||
CUVIDHEVCPICPARAMS hevc;
|
||||
CUVIDVP8PICPARAMS vp8;
|
||||
CUVIDVP9PICPARAMS vp9;
|
||||
unsigned int CodecReserved[1024];
|
||||
} CodecSpecific;
|
||||
} CUVIDPICPARAMS;
|
||||
|
||||
|
||||
/*!
|
||||
* \struct CUVIDPROCPARAMS
|
||||
* Picture Parameters for Postprocessing
|
||||
*/
|
||||
typedef struct _CUVIDPROCPARAMS
|
||||
{
|
||||
int progressive_frame; /**< Input is progressive (deinterlace_mode will be ignored) */
|
||||
int second_field; /**< Output the second field (ignored if deinterlace mode is Weave) */
|
||||
int top_field_first; /**< Input frame is top field first (1st field is top, 2nd field is bottom) */
|
||||
int unpaired_field; /**< Input only contains one field (2nd field is invalid) */
|
||||
// The fields below are used for raw YUV input
|
||||
unsigned int reserved_flags; /**< Reserved for future use (set to zero) */
|
||||
unsigned int reserved_zero; /**< Reserved (set to zero) */
|
||||
unsigned long long raw_input_dptr; /**< Input CUdeviceptr for raw YUV extensions */
|
||||
unsigned int raw_input_pitch; /**< pitch in bytes of raw YUV input (should be aligned appropriately) */
|
||||
unsigned int raw_input_format; /**< Reserved for future use (set to zero) */
|
||||
unsigned long long raw_output_dptr; /**< Reserved for future use (set to zero) */
|
||||
unsigned int raw_output_pitch; /**< Reserved for future use (set to zero) */
|
||||
unsigned int Reserved[48];
|
||||
void *Reserved3[3];
|
||||
} CUVIDPROCPARAMS;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* In order to minimize decode latencies, there should be always at least 2 pictures in the decode
|
||||
* queue at any time, in order to make sure that all decode engines are always busy.
|
||||
*
|
||||
* Overall data flow:
|
||||
* - cuvidCreateDecoder(...)
|
||||
* For each picture:
|
||||
* - cuvidDecodePicture(N)
|
||||
* - cuvidMapVideoFrame(N-4)
|
||||
* - do some processing in cuda
|
||||
* - cuvidUnmapVideoFrame(N-4)
|
||||
* - cuvidDecodePicture(N+1)
|
||||
* - cuvidMapVideoFrame(N-3)
|
||||
* ...
|
||||
* - cuvidDestroyDecoder(...)
|
||||
*
|
||||
* NOTE:
|
||||
* - When the cuda context is created from a D3D device, the D3D device must also be created
|
||||
* with the D3DCREATE_MULTITHREADED flag.
|
||||
* - There is a limit to how many pictures can be mapped simultaneously (ulNumOutputSurfaces)
|
||||
* - cuVidDecodePicture may block the calling thread if there are too many pictures pending
|
||||
* in the decode queue
|
||||
*/
|
||||
|
||||
/**
|
||||
* \fn CUresult CUDAAPI cuvidCreateDecoder(CUvideodecoder *phDecoder, CUVIDDECODECREATEINFO *pdci)
|
||||
* Create the decoder object
|
||||
*/
|
||||
CUresult CUDAAPI cuvidCreateDecoder(CUvideodecoder *phDecoder, CUVIDDECODECREATEINFO *pdci);
|
||||
|
||||
/**
|
||||
* \fn CUresult CUDAAPI cuvidDestroyDecoder(CUvideodecoder hDecoder)
|
||||
* Destroy the decoder object
|
||||
*/
|
||||
CUresult CUDAAPI cuvidDestroyDecoder(CUvideodecoder hDecoder);
|
||||
|
||||
/**
|
||||
* \fn CUresult CUDAAPI cuvidDecodePicture(CUvideodecoder hDecoder, CUVIDPICPARAMS *pPicParams)
|
||||
* Decode a single picture (field or frame)
|
||||
*/
|
||||
CUresult CUDAAPI cuvidDecodePicture(CUvideodecoder hDecoder, CUVIDPICPARAMS *pPicParams);
|
||||
|
||||
|
||||
#if !defined(__CUVID_DEVPTR64) || defined(__CUVID_INTERNAL)
|
||||
/**
|
||||
* \fn CUresult CUDAAPI cuvidMapVideoFrame(CUvideodecoder hDecoder, int nPicIdx, unsigned int *pDevPtr, unsigned int *pPitch, CUVIDPROCPARAMS *pVPP);
|
||||
* Post-process and map a video frame for use in cuda
|
||||
*/
|
||||
CUresult CUDAAPI cuvidMapVideoFrame(CUvideodecoder hDecoder, int nPicIdx,
|
||||
unsigned int *pDevPtr, unsigned int *pPitch,
|
||||
CUVIDPROCPARAMS *pVPP);
|
||||
|
||||
/**
|
||||
* \fn CUresult CUDAAPI cuvidUnmapVideoFrame(CUvideodecoder hDecoder, unsigned int DevPtr)
|
||||
* Unmap a previously mapped video frame
|
||||
*/
|
||||
CUresult CUDAAPI cuvidUnmapVideoFrame(CUvideodecoder hDecoder, unsigned int DevPtr);
|
||||
#endif
|
||||
|
||||
#if defined(WIN64) || defined(_WIN64) || defined(__x86_64) || defined(AMD64) || defined(_M_AMD64)
|
||||
/**
|
||||
* \fn CUresult CUDAAPI cuvidMapVideoFrame64(CUvideodecoder hDecoder, int nPicIdx, unsigned long long *pDevPtr, unsigned int *pPitch, CUVIDPROCPARAMS *pVPP);
|
||||
* map a video frame
|
||||
*/
|
||||
CUresult CUDAAPI cuvidMapVideoFrame64(CUvideodecoder hDecoder, int nPicIdx, unsigned long long *pDevPtr,
|
||||
unsigned int *pPitch, CUVIDPROCPARAMS *pVPP);
|
||||
|
||||
/**
|
||||
* \fn CUresult CUDAAPI cuvidUnmapVideoFrame64(CUvideodecoder hDecoder, unsigned long long DevPtr);
|
||||
* Unmap a previously mapped video frame
|
||||
*/
|
||||
CUresult CUDAAPI cuvidUnmapVideoFrame64(CUvideodecoder hDecoder, unsigned long long DevPtr);
|
||||
|
||||
#if defined(__CUVID_DEVPTR64) && !defined(__CUVID_INTERNAL)
|
||||
#define cuvidMapVideoFrame cuvidMapVideoFrame64
|
||||
#define cuvidUnmapVideoFrame cuvidUnmapVideoFrame64
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* Context-locking: to facilitate multi-threaded implementations, the following 4 functions
|
||||
* provide a simple mutex-style host synchronization. If a non-NULL context is specified
|
||||
* in CUVIDDECODECREATEINFO, the codec library will acquire the mutex associated with the given
|
||||
* context before making any cuda calls.
|
||||
* A multi-threaded application could create a lock associated with a context handle so that
|
||||
* multiple threads can safely share the same cuda context:
|
||||
* - use cuCtxPopCurrent immediately after context creation in order to create a 'floating' context
|
||||
* that can be passed to cuvidCtxLockCreate.
|
||||
* - When using a floating context, all cuda calls should only be made within a cuvidCtxLock/cuvidCtxUnlock section.
|
||||
*
|
||||
* NOTE: This is a safer alternative to cuCtxPushCurrent and cuCtxPopCurrent, and is not related to video
|
||||
* decoder in any way (implemented as a critical section associated with cuCtx{Push|Pop}Current calls).
|
||||
*/
|
||||
|
||||
/**
|
||||
* \fn CUresult CUDAAPI cuvidCtxLockCreate(CUvideoctxlock *pLock, CUcontext ctx)
|
||||
*/
|
||||
CUresult CUDAAPI cuvidCtxLockCreate(CUvideoctxlock *pLock, CUcontext ctx);
|
||||
|
||||
/**
|
||||
* \fn CUresult CUDAAPI cuvidCtxLockDestroy(CUvideoctxlock lck)
|
||||
*/
|
||||
CUresult CUDAAPI cuvidCtxLockDestroy(CUvideoctxlock lck);
|
||||
|
||||
/**
|
||||
* \fn CUresult CUDAAPI cuvidCtxLock(CUvideoctxlock lck, unsigned int reserved_flags)
|
||||
*/
|
||||
CUresult CUDAAPI cuvidCtxLock(CUvideoctxlock lck, unsigned int reserved_flags);
|
||||
|
||||
/**
|
||||
* \fn CUresult CUDAAPI cuvidCtxUnlock(CUvideoctxlock lck, unsigned int reserved_flags)
|
||||
*/
|
||||
CUresult CUDAAPI cuvidCtxUnlock(CUvideoctxlock lck, unsigned int reserved_flags);
|
||||
|
||||
/** @} */ /* End VIDEO_DECODER */
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#if defined(__cplusplus)
|
||||
|
||||
// Auto-lock helper for C++ applications
|
||||
class CCtxAutoLock
|
||||
{
|
||||
private:
|
||||
CUvideoctxlock m_ctx;
|
||||
public:
|
||||
CCtxAutoLock(CUvideoctxlock ctx);
|
||||
~CCtxAutoLock();
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif // __CUDA_VIDEO_H__
|
||||
|
||||
@@ -1,321 +0,0 @@
|
||||
/*
|
||||
* This copyright notice applies to this header file only:
|
||||
*
|
||||
* Copyright (c) 2010-2016 NVIDIA Corporation
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file nvcuvid.h
|
||||
* NvCuvid API provides Video Decoding interface to NVIDIA GPU devices.
|
||||
* \date 2015-2015
|
||||
* This file contains the interface constants, structure definitions and function prototypes.
|
||||
*/
|
||||
|
||||
#if !defined(__NVCUVID_H__)
|
||||
#define __NVCUVID_H__
|
||||
|
||||
#include "compat/cuda/cuviddec.h"
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/*********************************
|
||||
** Initialization
|
||||
*********************************/
|
||||
CUresult CUDAAPI cuvidInit(unsigned int Flags);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// High-level helper APIs for video sources
|
||||
//
|
||||
|
||||
typedef void *CUvideosource;
|
||||
typedef void *CUvideoparser;
|
||||
typedef long long CUvideotimestamp;
|
||||
|
||||
/**
|
||||
* \addtogroup VIDEO_PARSER Video Parser
|
||||
* @{
|
||||
*/
|
||||
|
||||
/*!
|
||||
* \enum cudaVideoState
|
||||
* Video Source State
|
||||
*/
|
||||
typedef enum {
|
||||
cudaVideoState_Error = -1, /**< Error state (invalid source) */
|
||||
cudaVideoState_Stopped = 0, /**< Source is stopped (or reached end-of-stream) */
|
||||
cudaVideoState_Started = 1 /**< Source is running and delivering data */
|
||||
} cudaVideoState;
|
||||
|
||||
/*!
|
||||
* \enum cudaAudioCodec
|
||||
* Audio compression
|
||||
*/
|
||||
typedef enum {
|
||||
cudaAudioCodec_MPEG1=0, /**< MPEG-1 Audio */
|
||||
cudaAudioCodec_MPEG2, /**< MPEG-2 Audio */
|
||||
cudaAudioCodec_MP3, /**< MPEG-1 Layer III Audio */
|
||||
cudaAudioCodec_AC3, /**< Dolby Digital (AC3) Audio */
|
||||
cudaAudioCodec_LPCM /**< PCM Audio */
|
||||
} cudaAudioCodec;
|
||||
|
||||
/*!
|
||||
* \struct CUVIDEOFORMAT
|
||||
* Video format
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
cudaVideoCodec codec; /**< Compression format */
|
||||
/**
|
||||
* frame rate = numerator / denominator (for example: 30000/1001)
|
||||
*/
|
||||
struct {
|
||||
unsigned int numerator; /**< frame rate numerator (0 = unspecified or variable frame rate) */
|
||||
unsigned int denominator; /**< frame rate denominator (0 = unspecified or variable frame rate) */
|
||||
} frame_rate;
|
||||
unsigned char progressive_sequence; /**< 0=interlaced, 1=progressive */
|
||||
unsigned char bit_depth_luma_minus8; /**< high bit depth Luma */
|
||||
unsigned char bit_depth_chroma_minus8; /**< high bit depth Chroma */
|
||||
unsigned char reserved1; /**< Reserved for future use */
|
||||
unsigned int coded_width; /**< coded frame width */
|
||||
unsigned int coded_height; /**< coded frame height */
|
||||
/**
|
||||
* area of the frame that should be displayed
|
||||
* typical example:
|
||||
* coded_width = 1920, coded_height = 1088
|
||||
* display_area = { 0,0,1920,1080 }
|
||||
*/
|
||||
struct {
|
||||
int left; /**< left position of display rect */
|
||||
int top; /**< top position of display rect */
|
||||
int right; /**< right position of display rect */
|
||||
int bottom; /**< bottom position of display rect */
|
||||
} display_area;
|
||||
cudaVideoChromaFormat chroma_format; /**< Chroma format */
|
||||
unsigned int bitrate; /**< video bitrate (bps, 0=unknown) */
|
||||
/**
|
||||
* Display Aspect Ratio = x:y (4:3, 16:9, etc)
|
||||
*/
|
||||
struct {
|
||||
int x;
|
||||
int y;
|
||||
} display_aspect_ratio;
|
||||
/**
|
||||
* Video Signal Description
|
||||
*/
|
||||
struct {
|
||||
unsigned char video_format : 3;
|
||||
unsigned char video_full_range_flag : 1;
|
||||
unsigned char reserved_zero_bits : 4;
|
||||
unsigned char color_primaries;
|
||||
unsigned char transfer_characteristics;
|
||||
unsigned char matrix_coefficients;
|
||||
} video_signal_description;
|
||||
unsigned int seqhdr_data_length; /**< Additional bytes following (CUVIDEOFORMATEX) */
|
||||
} CUVIDEOFORMAT;
|
||||
|
||||
/*!
|
||||
* \struct CUVIDEOFORMATEX
|
||||
* Video format including raw sequence header information
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
CUVIDEOFORMAT format;
|
||||
unsigned char raw_seqhdr_data[1024];
|
||||
} CUVIDEOFORMATEX;
|
||||
|
||||
/*!
|
||||
* \struct CUAUDIOFORMAT
|
||||
* Audio Formats
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
cudaAudioCodec codec; /**< Compression format */
|
||||
unsigned int channels; /**< number of audio channels */
|
||||
unsigned int samplespersec; /**< sampling frequency */
|
||||
unsigned int bitrate; /**< For uncompressed, can also be used to determine bits per sample */
|
||||
unsigned int reserved1; /**< Reserved for future use */
|
||||
unsigned int reserved2; /**< Reserved for future use */
|
||||
} CUAUDIOFORMAT;
|
||||
|
||||
|
||||
/*!
|
||||
* \enum CUvideopacketflags
|
||||
* Data packet flags
|
||||
*/
|
||||
typedef enum {
|
||||
CUVID_PKT_ENDOFSTREAM = 0x01, /**< Set when this is the last packet for this stream */
|
||||
CUVID_PKT_TIMESTAMP = 0x02, /**< Timestamp is valid */
|
||||
CUVID_PKT_DISCONTINUITY = 0x04 /**< Set when a discontinuity has to be signalled */
|
||||
} CUvideopacketflags;
|
||||
|
||||
/*!
|
||||
* \struct CUVIDSOURCEDATAPACKET
|
||||
* Data Packet
|
||||
*/
|
||||
typedef struct _CUVIDSOURCEDATAPACKET
|
||||
{
|
||||
unsigned long flags; /**< Combination of CUVID_PKT_XXX flags */
|
||||
unsigned long payload_size; /**< number of bytes in the payload (may be zero if EOS flag is set) */
|
||||
const unsigned char *payload; /**< Pointer to packet payload data (may be NULL if EOS flag is set) */
|
||||
CUvideotimestamp timestamp; /**< Presentation timestamp (10MHz clock), only valid if CUVID_PKT_TIMESTAMP flag is set */
|
||||
} CUVIDSOURCEDATAPACKET;
|
||||
|
||||
// Callback for packet delivery
|
||||
typedef int (CUDAAPI *PFNVIDSOURCECALLBACK)(void *, CUVIDSOURCEDATAPACKET *);
|
||||
|
||||
/*!
|
||||
* \struct CUVIDSOURCEPARAMS
|
||||
* Source Params
|
||||
*/
|
||||
typedef struct _CUVIDSOURCEPARAMS
|
||||
{
|
||||
unsigned int ulClockRate; /**< Timestamp units in Hz (0=default=10000000Hz) */
|
||||
unsigned int uReserved1[7]; /**< Reserved for future use - set to zero */
|
||||
void *pUserData; /**< Parameter passed in to the data handlers */
|
||||
PFNVIDSOURCECALLBACK pfnVideoDataHandler; /**< Called to deliver audio packets */
|
||||
PFNVIDSOURCECALLBACK pfnAudioDataHandler; /**< Called to deliver video packets */
|
||||
void *pvReserved2[8]; /**< Reserved for future use - set to NULL */
|
||||
} CUVIDSOURCEPARAMS;
|
||||
|
||||
/*!
|
||||
* \enum CUvideosourceformat_flags
|
||||
* CUvideosourceformat_flags
|
||||
*/
|
||||
typedef enum {
|
||||
CUVID_FMT_EXTFORMATINFO = 0x100 /**< Return extended format structure (CUVIDEOFORMATEX) */
|
||||
} CUvideosourceformat_flags;
|
||||
|
||||
#if !defined(__APPLE__)
|
||||
/**
|
||||
* \fn CUresult CUDAAPI cuvidCreateVideoSource(CUvideosource *pObj, const char *pszFileName, CUVIDSOURCEPARAMS *pParams)
|
||||
* Create Video Source
|
||||
*/
|
||||
CUresult CUDAAPI cuvidCreateVideoSource(CUvideosource *pObj, const char *pszFileName, CUVIDSOURCEPARAMS *pParams);
|
||||
|
||||
/**
|
||||
* \fn CUresult CUDAAPI cuvidCreateVideoSourceW(CUvideosource *pObj, const wchar_t *pwszFileName, CUVIDSOURCEPARAMS *pParams)
|
||||
* Create Video Source
|
||||
*/
|
||||
CUresult CUDAAPI cuvidCreateVideoSourceW(CUvideosource *pObj, const wchar_t *pwszFileName, CUVIDSOURCEPARAMS *pParams);
|
||||
|
||||
/**
|
||||
* \fn CUresult CUDAAPI cuvidDestroyVideoSource(CUvideosource obj)
|
||||
* Destroy Video Source
|
||||
*/
|
||||
CUresult CUDAAPI cuvidDestroyVideoSource(CUvideosource obj);
|
||||
|
||||
/**
|
||||
* \fn CUresult CUDAAPI cuvidSetVideoSourceState(CUvideosource obj, cudaVideoState state)
|
||||
* Set Video Source state
|
||||
*/
|
||||
CUresult CUDAAPI cuvidSetVideoSourceState(CUvideosource obj, cudaVideoState state);
|
||||
|
||||
/**
|
||||
* \fn cudaVideoState CUDAAPI cuvidGetVideoSourceState(CUvideosource obj)
|
||||
* Get Video Source state
|
||||
*/
|
||||
cudaVideoState CUDAAPI cuvidGetVideoSourceState(CUvideosource obj);
|
||||
|
||||
/**
|
||||
* \fn CUresult CUDAAPI cuvidGetSourceVideoFormat(CUvideosource obj, CUVIDEOFORMAT *pvidfmt, unsigned int flags)
|
||||
* Get Video Source Format
|
||||
*/
|
||||
CUresult CUDAAPI cuvidGetSourceVideoFormat(CUvideosource obj, CUVIDEOFORMAT *pvidfmt, unsigned int flags);
|
||||
|
||||
/**
|
||||
* \fn CUresult CUDAAPI cuvidGetSourceAudioFormat(CUvideosource obj, CUAUDIOFORMAT *paudfmt, unsigned int flags)
|
||||
* Set Video Source state
|
||||
*/
|
||||
CUresult CUDAAPI cuvidGetSourceAudioFormat(CUvideosource obj, CUAUDIOFORMAT *paudfmt, unsigned int flags);
|
||||
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \struct CUVIDPARSERDISPINFO
|
||||
*/
|
||||
typedef struct _CUVIDPARSERDISPINFO
|
||||
{
|
||||
int picture_index; /**< */
|
||||
int progressive_frame; /**< */
|
||||
int top_field_first; /**< */
|
||||
int repeat_first_field; /**< Number of additional fields (1=ivtc, 2=frame doubling, 4=frame tripling, -1=unpaired field) */
|
||||
CUvideotimestamp timestamp; /**< */
|
||||
} CUVIDPARSERDISPINFO;
|
||||
|
||||
//
|
||||
// Parser callbacks
|
||||
// The parser will call these synchronously from within cuvidParseVideoData(), whenever a picture is ready to
|
||||
// be decoded and/or displayed.
|
||||
//
|
||||
typedef int (CUDAAPI *PFNVIDSEQUENCECALLBACK)(void *, CUVIDEOFORMAT *);
|
||||
typedef int (CUDAAPI *PFNVIDDECODECALLBACK)(void *, CUVIDPICPARAMS *);
|
||||
typedef int (CUDAAPI *PFNVIDDISPLAYCALLBACK)(void *, CUVIDPARSERDISPINFO *);
|
||||
|
||||
/**
|
||||
* \struct CUVIDPARSERPARAMS
|
||||
*/
|
||||
typedef struct _CUVIDPARSERPARAMS
|
||||
{
|
||||
cudaVideoCodec CodecType; /**< cudaVideoCodec_XXX */
|
||||
unsigned int ulMaxNumDecodeSurfaces; /**< Max # of decode surfaces (parser will cycle through these) */
|
||||
unsigned int ulClockRate; /**< Timestamp units in Hz (0=default=10000000Hz) */
|
||||
unsigned int ulErrorThreshold; /**< % Error threshold (0-100) for calling pfnDecodePicture (100=always call pfnDecodePicture even if picture bitstream is fully corrupted) */
|
||||
unsigned int ulMaxDisplayDelay; /**< Max display queue delay (improves pipelining of decode with display) - 0=no delay (recommended values: 2..4) */
|
||||
unsigned int uReserved1[5]; /**< Reserved for future use - set to 0 */
|
||||
void *pUserData; /**< User data for callbacks */
|
||||
PFNVIDSEQUENCECALLBACK pfnSequenceCallback; /**< Called before decoding frames and/or whenever there is a format change */
|
||||
PFNVIDDECODECALLBACK pfnDecodePicture; /**< Called when a picture is ready to be decoded (decode order) */
|
||||
PFNVIDDISPLAYCALLBACK pfnDisplayPicture; /**< Called whenever a picture is ready to be displayed (display order) */
|
||||
void *pvReserved2[7]; /**< Reserved for future use - set to NULL */
|
||||
CUVIDEOFORMATEX *pExtVideoInfo; /**< [Optional] sequence header data from system layer */
|
||||
} CUVIDPARSERPARAMS;
|
||||
|
||||
/**
|
||||
* \fn CUresult CUDAAPI cuvidCreateVideoParser(CUvideoparser *pObj, CUVIDPARSERPARAMS *pParams)
|
||||
*/
|
||||
CUresult CUDAAPI cuvidCreateVideoParser(CUvideoparser *pObj, CUVIDPARSERPARAMS *pParams);
|
||||
|
||||
/**
|
||||
* \fn CUresult CUDAAPI cuvidParseVideoData(CUvideoparser obj, CUVIDSOURCEDATAPACKET *pPacket)
|
||||
*/
|
||||
CUresult CUDAAPI cuvidParseVideoData(CUvideoparser obj, CUVIDSOURCEDATAPACKET *pPacket);
|
||||
|
||||
/**
|
||||
* \fn CUresult CUDAAPI cuvidDestroyVideoParser(CUvideoparser obj)
|
||||
*/
|
||||
CUresult CUDAAPI cuvidDestroyVideoParser(CUvideoparser obj);
|
||||
|
||||
/** @} */ /* END VIDEO_PARSER */
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif // __NVCUVID_H__
|
||||
|
||||
|
||||
@@ -1,42 +0,0 @@
|
||||
/*
|
||||
* 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 COMPAT_DISPATCH_SEMAPHORE_SEMAPHORE_H
|
||||
#define COMPAT_DISPATCH_SEMAPHORE_SEMAPHORE_H
|
||||
|
||||
#include <dispatch/dispatch.h>
|
||||
#include <errno.h>
|
||||
|
||||
#define sem_t dispatch_semaphore_t
|
||||
#define sem_post(psem) dispatch_semaphore_signal(*psem)
|
||||
#define sem_wait(psem) dispatch_semaphore_wait(*psem, DISPATCH_TIME_FOREVER)
|
||||
#define sem_timedwait(psem, val) dispatch_semaphore_wait(*psem, dispatch_walltime(val, 0))
|
||||
#define sem_destroy(psem) dispatch_release(*psem)
|
||||
|
||||
static inline int compat_sem_init(dispatch_semaphore_t *psem,
|
||||
int unused, int val)
|
||||
{
|
||||
int ret = !!(*psem = dispatch_semaphore_create(val)) - 1;
|
||||
if (ret < 0)
|
||||
errno = ENOMEM;
|
||||
return ret;
|
||||
}
|
||||
|
||||
#define sem_init compat_sem_init
|
||||
|
||||
#endif /* COMPAT_DISPATCH_SEMAPHORE_SEMAPHORE_H */
|
||||
File diff suppressed because it is too large
Load Diff
9
doc/.gitignore
vendored
9
doc/.gitignore
vendored
@@ -1,9 +0,0 @@
|
||||
/*.1
|
||||
/*.3
|
||||
/*.html
|
||||
/*.pod
|
||||
/config.texi
|
||||
/avoptions_codec.texi
|
||||
/avoptions_format.texi
|
||||
/fate.txt
|
||||
/print_options
|
||||
184
doc/APIchanges
184
doc/APIchanges
@@ -15,188 +15,6 @@ libavutil: 2015-08-28
|
||||
|
||||
API changes, most recent first:
|
||||
|
||||
-------- 8< --------- FFmpeg 3.2 was cut here -------- 8< ---------
|
||||
|
||||
2016-10-24 - 73ead47 - lavf 57.55.100 - avformat.h
|
||||
Add AV_DISPOSITION_TIMED_THUMBNAILS
|
||||
|
||||
2016-10-24 - a246fef - lavf 57.54.100 - avformat.h
|
||||
Add avformat_init_output() and AVSTREAM_INIT_IN_ macros
|
||||
|
||||
2016-10-22 - f5495c9 - lavu 55.33.100 - avassert.h
|
||||
Add av_assert0_fpu() / av_assert2_fpu()
|
||||
|
||||
2016-10-07 - 3f9137c / 32c8359 - lavc 57.61.100 / 57.24.0 - avcodec.h
|
||||
Decoders now export the frame timestamp as AVFrame.pts. It was
|
||||
previously exported as AVFrame.pkt_pts, which is now deprecated.
|
||||
|
||||
Note: When decoding, AVFrame.pts uses the stream/packet timebase,
|
||||
and not the codec timebase.
|
||||
|
||||
2016-09-28 - eba0414 - lavu 55.32.100 / 55.16.0 - hwcontext.h hwcontext_qsv.h
|
||||
Add AV_HWDEVICE_TYPE_QSV and a new installed header with QSV-specific
|
||||
hwcontext definitions.
|
||||
|
||||
2016-09-26 - 32c25f0 - lavc 57.59.100 / 57.23.0 - avcodec.h
|
||||
AVCodecContext.hw_frames_ctx now may be used by decoders.
|
||||
|
||||
2016-09-27 - f0b6f72 - lavf 57.51.100 - avformat.h
|
||||
Add av_stream_get_codec_timebase()
|
||||
|
||||
2016-09-27 - 23c0779 - lswr 2.2.100 - swresample.h
|
||||
Add swr_build_matrix().
|
||||
|
||||
2016-09-23 - 30d3e36 - lavc 57.58.100 - avcodec.h
|
||||
Add AV_CODEC_CAP_AVOID_PROBING codec capability flag.
|
||||
|
||||
2016-09-14 - ae1dd0c - lavf 57.49.100 - avformat.h
|
||||
Add avformat_transfer_internal_stream_timing_info helper to help with stream
|
||||
copy.
|
||||
|
||||
2016-08-29 - 4493390 - lavfi 6.58.100 - avfilter.h
|
||||
Add AVFilterContext.nb_threads.
|
||||
|
||||
2016-08-15 - c3c4c72 - lavc 57.53.100 - avcodec.h
|
||||
Add trailing_padding to AVCodecContext to match the corresponding
|
||||
field in AVCodecParameters.
|
||||
|
||||
2016-08-15 - b746ed7 - lavc 57.52.100 - avcodec.h
|
||||
Add a new API for chained BSF filters and passthrough (null) BSF --
|
||||
av_bsf_list_alloc(), av_bsf_list_free(), av_bsf_list_append(),
|
||||
av_bsf_list_append2(), av_bsf_list_finalize(), av_bsf_list_parse_str()
|
||||
and av_bsf_get_null_filter().
|
||||
|
||||
2016-08-04 - 82a33c8 - lavf 57.46.100 - avformat.h
|
||||
Add av_get_frame_filename2()
|
||||
|
||||
2016-07-09 - 775389f / 90f469a - lavc 57.50.100 / 57.20.0 - avcodec.h
|
||||
Add FF_PROFILE_H264_MULTIVIEW_HIGH and FF_PROFILE_H264_STEREO_HIGH.
|
||||
|
||||
2016-06-30 - c1c7e0ab - lavf 57.41.100 - avformat.h
|
||||
Moved codecpar field from AVStream to the end of the struct, so that
|
||||
the following private fields are in the same location as in FFmpeg 3.0 (lavf 57.25.100).
|
||||
|
||||
2016-06-30 - 042fb69d - lavu 55.28.100 - frame.h
|
||||
Moved hw_frames_ctx field from AVFrame to the end of the struct, so that
|
||||
the following private fields are in the same location as in FFmpeg 3.0 (lavu 55.17.103).
|
||||
|
||||
2016-06-29 - 1a751455 - lavfi 6.47.100 - avfilter.h
|
||||
Fix accidental ABI breakage in AVFilterContext.
|
||||
ABI was broken in 8688d3a, lavfi 6.42.100 and released as ffmpeg 3.1.
|
||||
|
||||
Because of this, ffmpeg and ffplay built against lavfi>=6.42.100 will not be
|
||||
compatible with lavfi>=6.47.100. Potentially also affects other users of
|
||||
libavfilter if they are using one of the affected fields.
|
||||
|
||||
-------- 8< --------- FFmpeg 3.1 was cut here -------- 8< ---------
|
||||
|
||||
2016-06-26 - 481f320 / 1c9e861 - lavu 55.27.100 / 55.13.0 - hwcontext.h
|
||||
Add av_hwdevice_ctx_create().
|
||||
|
||||
2016-06-26 - b95534b / e47b8bb - lavc 57.48.101 / 57.19.1 - avcodec.h
|
||||
Adjust values for JPEG 2000 profiles.
|
||||
|
||||
2016-06-23 - 5d75e46 / db7968b - lavf 57.40.100 / 57.7.0 - avio.h
|
||||
Add AVIODataMarkerType, write_data_type, ignore_boundary_point and
|
||||
avio_write_marker.
|
||||
|
||||
2016-06-23 - abb3cc4 / 0c4468d - lavu 55.26.100 / 55.12.0 - opt.h
|
||||
Add av_stereo3d_type_name() and av_stereo3d_from_name().
|
||||
|
||||
2016-06-22 - 3689efe / c46db38 - lavu 55.25.100 / 55.11.0 - hwcontext_dxva2.h
|
||||
Add new installed header with DXVA2-specific hwcontext definitions.
|
||||
|
||||
2016-04-27 - fb91871 - lavu 55.23.100 - log.h
|
||||
Add a new function av_log_format_line2() which returns number of bytes
|
||||
written to the target buffer.
|
||||
|
||||
2016-04-21 - 7fc329e - lavc 57.37.100 - avcodec.h
|
||||
Add a new audio/video encoding and decoding API with decoupled input
|
||||
and output -- avcodec_send_packet(), avcodec_receive_frame(),
|
||||
avcodec_send_frame() and avcodec_receive_packet().
|
||||
|
||||
2016-04-17 - af9cac1 / 33d1898 - lavc 57.35.100 / 57.15.0 - avcodec.h
|
||||
Add a new bitstream filtering API working with AVPackets.
|
||||
Deprecate the old bitstream filtering API.
|
||||
|
||||
2016-04-14 - 8688d3a / 07a844f - lavfi 6.42.100 / 6.3.0 - avfilter.h
|
||||
Add AVFilterContext.hw_device_ctx.
|
||||
|
||||
2016-04-14 - 28abb21 / 551c677 - lavu 55.22.100 / 55.9.0 - hwcontext_vaapi.h
|
||||
Add new installed header with VAAPI-specific hwcontext definitions.
|
||||
|
||||
2016-04-14 - afccfaf / b1f01e8 - lavu 55.21.100 / 55.7.0 - hwcontext.h
|
||||
Add AVHWFramesConstraints and associated API.
|
||||
|
||||
2016-04-11 - 6f69f7a / 9200514 - lavf 57.33.100 / 57.5.0 - avformat.h
|
||||
Add AVStream.codecpar, deprecate AVStream.codec.
|
||||
|
||||
2016-04-02 - e8a9b64 - lavu 55.20.100 - base64.h
|
||||
Add AV_BASE64_DECODE_SIZE(x) macro.
|
||||
|
||||
2016-xx-xx - lavc 57.33.100 / 57.14.0 - avcodec.h
|
||||
f9b1cf1 / 998e1b8 - Add AVCodecParameters and its related API.
|
||||
e6053b3 / a806834 - Add av_get_audio_frame_duration2().
|
||||
|
||||
2016-03-11 - 6d8ab35 - lavf/lavc 57.28.101
|
||||
Add requirement to bitstream filtering API that returned packets with
|
||||
size == 0 and side_data_elems == 0 are to be skipped by the caller.
|
||||
|
||||
2016-03-04 - 9362973 - lavf 57.28.100
|
||||
Add protocol blacklisting API
|
||||
|
||||
2016-02-28 - 4dd4d53 - lavc 57.27.101
|
||||
Validate AVFrame returned by get_buffer2 to have required
|
||||
planes not NULL and unused planes set to NULL as crashes
|
||||
and buffer overflow are possible with certain streams if
|
||||
that is not the case.
|
||||
|
||||
2016-02-26 - 30e7685 - lavc 57.27.100 - avcodec.h
|
||||
"flags2" decoding option now allows the flag "ass_ro_flush_noop" preventing
|
||||
the reset of the ASS ReadOrder field on flush. This affects the content of
|
||||
AVSubtitles.rects[N]->ass when "sub_text_format" is set to "ass" (see
|
||||
previous entry).
|
||||
|
||||
2016-02-26 - 2941282 - lavc 57.26.100 - avcodec.h
|
||||
Add a "sub_text_format" subtitles decoding option allowing the values "ass"
|
||||
(recommended) and "ass_with_timings" (not recommended, deprecated, default).
|
||||
The default value for this option will change to "ass" at the next major
|
||||
libavcodec version bump.
|
||||
|
||||
The current default is "ass_with_timings" for compatibility. This means that
|
||||
all subtitles text decoders currently still output ASS with timings printed
|
||||
as strings in the AVSubtitles.rects[N]->ass fields.
|
||||
|
||||
Setting "sub_text_format" to "ass" allows a better timing accuracy (ASS
|
||||
timing is limited to a 1/100 time base, so this is relevant for any subtitles
|
||||
format needing a bigger one), ease timing adjustments, and prevents the need
|
||||
of removing the timing from the decoded string yourself. This form is also
|
||||
known as "the Matroska form". The timing information (start time, duration)
|
||||
can be found in the AVSubtitles fields.
|
||||
|
||||
2016-02-24 - 7e49cdd / 7b3214d0 - lavc 57.25.100 / 57.13.0 - avcodec.h
|
||||
Add AVCodecContext.hw_frames_ctx.
|
||||
|
||||
2016-02-24 - 1042402 / b3dd30d - lavfi 6.36.100 / 6.2.0 - avfilter.h
|
||||
avfilter.h - Add AVFilterLink.hw_frames_ctx.
|
||||
buffersrc.h - Add AVBufferSrcParameters and functions for handling it.
|
||||
|
||||
2016-02-23 - 14f7a3d - lavc 57.25.100
|
||||
Add AV_PKT_DATA_MPEGTS_STREAM_ID for exporting the MPEGTS stream ID.
|
||||
|
||||
2016-02-18 - 08acab8 - lavu 55.18.100 - audio_fifo.h
|
||||
Add av_audio_fifo_peek_at().
|
||||
|
||||
2016-xx-xx - lavu 55.18.100 / 55.6.0
|
||||
26abd51 / 721a4ef buffer.h - Add av_buffer_pool_init2().
|
||||
1a70878 / 89923e4 hwcontext.h - Add a new installed header hwcontext.h with a new API
|
||||
for handling hwaccel frames.
|
||||
6992276 / ad884d1 hwcontext_cuda.h - Add a new installed header hwcontext_cuda.h with
|
||||
CUDA-specific hwcontext definitions.
|
||||
d779d8d / a001ce3 hwcontext_vdpau.h - Add a new installed header hwcontext_vdpau.h with
|
||||
VDPAU-specific hwcontext definitions.
|
||||
63c3e35 / 7bc780c pixfmt.h - Add AV_PIX_FMT_CUDA.
|
||||
|
||||
-------- 8< --------- FFmpeg 3.0 was cut here -------- 8< ---------
|
||||
|
||||
2016-02-10 - bc9a596 / 9f61abc - lavf 57.25.100 / 57.3.0 - avformat.h
|
||||
@@ -1266,7 +1084,7 @@ lavd 54.4.100 / 54.0.0, lavfi 3.5.0
|
||||
* base -- is now stored in AVBufferRef
|
||||
* reference, type, buffer_hints -- are unnecessary in the new API
|
||||
* hwaccel_picture_private, owner, thread_opaque -- should not
|
||||
have been accessed from outside of lavc
|
||||
have been acessed from outside of lavc
|
||||
* qscale_table, qstride, qscale_type, mbskip_table, motion_val,
|
||||
mb_type, dct_coeff, ref_index -- mpegvideo-specific tables,
|
||||
which are not exported anymore.
|
||||
|
||||
2422
doc/Doxyfile
2422
doc/Doxyfile
File diff suppressed because it is too large
Load Diff
@@ -38,13 +38,13 @@ DOCS = $(DOCS-yes)
|
||||
|
||||
DOC_EXAMPLES-$(CONFIG_AVIO_DIR_CMD_EXAMPLE) += avio_dir_cmd
|
||||
DOC_EXAMPLES-$(CONFIG_AVIO_READING_EXAMPLE) += avio_reading
|
||||
DOC_EXAMPLES-$(CONFIG_AVCODEC_EXAMPLE) += avcodec
|
||||
DOC_EXAMPLES-$(CONFIG_DECODING_ENCODING_EXAMPLE) += decoding_encoding
|
||||
DOC_EXAMPLES-$(CONFIG_DEMUXING_DECODING_EXAMPLE) += demuxing_decoding
|
||||
DOC_EXAMPLES-$(CONFIG_EXTRACT_MVS_EXAMPLE) += extract_mvs
|
||||
DOC_EXAMPLES-$(CONFIG_FILTER_AUDIO_EXAMPLE) += filter_audio
|
||||
DOC_EXAMPLES-$(CONFIG_FILTERING_AUDIO_EXAMPLE) += filtering_audio
|
||||
DOC_EXAMPLES-$(CONFIG_FILTERING_VIDEO_EXAMPLE) += filtering_video
|
||||
DOC_EXAMPLES-$(CONFIG_HTTP_MULTICLIENT_EXAMPLE) += http_multiclient
|
||||
DOC_EXAMPLES-$(CONFIG_METADATA_EXAMPLE) += metadata
|
||||
DOC_EXAMPLES-$(CONFIG_MUXING_EXAMPLE) += muxing
|
||||
DOC_EXAMPLES-$(CONFIG_QSVDEC_EXAMPLE) += qsvdec
|
||||
@@ -125,7 +125,7 @@ $(DOC_EXAMPLES:%$(EXESUF)=%.o): | doc/examples
|
||||
OBJDIRS += doc/examples
|
||||
|
||||
DOXY_INPUT = $(INSTHEADERS) $(DOC_EXAMPLES:%$(EXESUF)=%.c) $(LIB_EXAMPLES:%$(EXESUF)=%.c)
|
||||
DOXY_INPUT_DEPS = $(addprefix $(SRC_PATH)/, $(DOXY_INPUT)) config.mak
|
||||
DOXY_INPUT_DEPS = $(addprefix $(SRC_PATH)/, $(DOXY_INPUT))
|
||||
|
||||
doc/doxy/html: TAG = DOXY
|
||||
doc/doxy/html: $(SRC_PATH)/doc/Doxyfile $(SRC_PATH)/doc/doxy-wrapper.sh $(DOXY_INPUT_DEPS)
|
||||
|
||||
@@ -18,7 +18,7 @@ comma-separated list of filters, whose parameters follow the filter
|
||||
name after a '='.
|
||||
|
||||
@example
|
||||
ffmpeg -i INPUT -c:v copy -bsf:v filter1[=opt1=str1:opt2=str2][,filter2] OUTPUT
|
||||
ffmpeg -i INPUT -c:v copy -bsf:v filter1[=opt1=str1/opt2=str2][,filter2] OUTPUT
|
||||
@end example
|
||||
|
||||
Below is a description of the currently available bitstream filters,
|
||||
@@ -67,10 +67,6 @@ 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 dca_core
|
||||
|
||||
Extract DCA core from DTS-HD streams.
|
||||
|
||||
@section h264_mp4toannexb
|
||||
|
||||
Convert an H.264 bitstream from length prefixed mode to start code
|
||||
|
||||
@@ -39,6 +39,9 @@ examples
|
||||
libavformat/output-example
|
||||
Build the libavformat basic example.
|
||||
|
||||
libavcodec/api-example
|
||||
Build the libavcodec basic example.
|
||||
|
||||
libswscale/swscale-test
|
||||
Build the swscale self-test (useful also as an example).
|
||||
|
||||
|
||||
@@ -257,7 +257,7 @@ Specify how strictly to follow the standards.
|
||||
Possible values:
|
||||
@table @samp
|
||||
@item very
|
||||
strictly conform to an older more strict version of the spec or reference software
|
||||
strictly conform to a older more strict version of the spec or reference software
|
||||
@item strict
|
||||
strictly conform to all the things in the spec no matter what consequences
|
||||
@item normal
|
||||
@@ -456,9 +456,6 @@ Possible values:
|
||||
@item aspect @var{rational number} (@emph{encoding,video})
|
||||
Set sample aspect ratio.
|
||||
|
||||
@item sar @var{rational number} (@emph{encoding,video})
|
||||
Set sample aspect ratio. Alias to @var{aspect}.
|
||||
|
||||
@item debug @var{flags} (@emph{decoding/encoding,audio,video,subtitles})
|
||||
Print specific debug info.
|
||||
|
||||
@@ -1049,93 +1046,9 @@ Possible values:
|
||||
@item rc_max_vbv_use @var{float} (@emph{encoding,video})
|
||||
@item rc_min_vbv_use @var{float} (@emph{encoding,video})
|
||||
@item ticks_per_frame @var{integer} (@emph{decoding/encoding,audio,video})
|
||||
|
||||
@item color_primaries @var{integer} (@emph{decoding/encoding,video})
|
||||
Possible values:
|
||||
@table @samp
|
||||
@item bt709
|
||||
BT.709
|
||||
@item bt470m
|
||||
BT.470 M
|
||||
@item bt470bg
|
||||
BT.470 BG
|
||||
@item smpte170m
|
||||
SMPTE 170 M
|
||||
@item smpte240m
|
||||
SMPTE 240 M
|
||||
@item film
|
||||
Film
|
||||
@item bt2020
|
||||
BT.2020
|
||||
@item smpte428_1
|
||||
SMPTE ST 428-1
|
||||
@item smpte431
|
||||
SMPTE 431-2
|
||||
@item smpte432
|
||||
SMPTE 432-1
|
||||
@end table
|
||||
|
||||
@item color_trc @var{integer} (@emph{decoding/encoding,video})
|
||||
Possible values:
|
||||
@table @samp
|
||||
@item bt709
|
||||
BT.709
|
||||
@item gamma22
|
||||
BT.470 M
|
||||
@item gamma28
|
||||
BT.470 BG
|
||||
@item smpte170m
|
||||
SMPTE 170 M
|
||||
@item smpte240m
|
||||
SMPTE 240 M
|
||||
@item linear
|
||||
Linear
|
||||
@item log
|
||||
Log
|
||||
@item log_sqrt
|
||||
Log square root
|
||||
@item iec61966_2_4
|
||||
IEC 61966-2-4
|
||||
@item bt1361
|
||||
BT.1361
|
||||
@item iec61966_2_1
|
||||
IEC 61966-2-1
|
||||
@item bt2020_10bit
|
||||
BT.2020 - 10 bit
|
||||
@item bt2020_12bit
|
||||
BT.2020 - 12 bit
|
||||
@item smpte2084
|
||||
SMPTE ST 2084
|
||||
@item smpte428_1
|
||||
SMPTE ST 428-1
|
||||
@item arib-std-b67
|
||||
ARIB STD-B67
|
||||
@end table
|
||||
|
||||
@item colorspace @var{integer} (@emph{decoding/encoding,video})
|
||||
Possible values:
|
||||
@table @samp
|
||||
@item rgb
|
||||
RGB
|
||||
@item bt709
|
||||
BT.709
|
||||
@item fcc
|
||||
FCC
|
||||
@item bt470bg
|
||||
BT.470 BG
|
||||
@item smpte170m
|
||||
SMPTE 170 M
|
||||
@item smpte240m
|
||||
SMPTE 240 M
|
||||
@item ycocg
|
||||
YCOCG
|
||||
@item bt2020_ncl
|
||||
BT.2020 NCL
|
||||
@item bt2020_cl
|
||||
BT.2020 CL
|
||||
@item smpte2085
|
||||
SMPTE 2085
|
||||
@end table
|
||||
|
||||
@item color_range @var{integer} (@emph{decoding/encoding,video})
|
||||
If used as input parameter, it serves as a hint to the decoder, which
|
||||
@@ -1226,7 +1139,7 @@ Set to 1 to disable processing alpha (transparency). This works like the
|
||||
instead of alpha. Default is 0.
|
||||
|
||||
@item codec_whitelist @var{list} (@emph{input})
|
||||
"," separated list of allowed decoders. By default all are allowed.
|
||||
"," separated List of allowed decoders. By default all are allowed.
|
||||
|
||||
@item dump_separator @var{string} (@emph{input})
|
||||
Separator used to separate the fields printed on the command line about the
|
||||
|
||||
@@ -279,7 +279,7 @@ present between the subtitle lines because of double-sized teletext charactes.
|
||||
Default value is 1.
|
||||
@item txt_duration
|
||||
Sets the display duration of the decoded teletext pages or subtitles in
|
||||
milliseconds. Default value is 30000 which is 30 seconds.
|
||||
miliseconds. Default value is 30000 which is 30 seconds.
|
||||
@item txt_transparent
|
||||
Force transparent background of the generated teletext bitmaps. Default value
|
||||
is 0 which means an opaque background.
|
||||
|
||||
@@ -72,7 +72,7 @@ Do not try to resynchronize by looking for a certain optional start code.
|
||||
Virtual concatenation script demuxer.
|
||||
|
||||
This demuxer reads a list of files and other directives from a text file and
|
||||
demuxes them one after the other, as if all their packets had been muxed
|
||||
demuxes them one after the other, as if all their packet had been muxed
|
||||
together.
|
||||
|
||||
The timestamps in the files are adjusted so that the first file starts at 0
|
||||
@@ -104,10 +104,10 @@ 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.
|
||||
to 1 if it was to its default -1.
|
||||
|
||||
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
|
||||
appears exactly as is (no extra space or byte-order-mark) on the very first
|
||||
line of the script.
|
||||
|
||||
@item @code{duration @var{dur}}
|
||||
@@ -192,9 +192,7 @@ component.
|
||||
|
||||
If set to 0, any file name is accepted.
|
||||
|
||||
The default is 1.
|
||||
|
||||
-1 is equivalent to 1 if the format was automatically
|
||||
The default is -1, it is equivalent to 1 if the format was automatically
|
||||
probed and 0 otherwise.
|
||||
|
||||
@item auto_convert
|
||||
@@ -254,6 +252,19 @@ This demuxer is used to demux FLV files and RTMP network streams.
|
||||
Allocate the streams according to the onMetaData array content.
|
||||
@end table
|
||||
|
||||
@section libgme
|
||||
|
||||
The Game Music Emu library is a collection of video game music file emulators.
|
||||
|
||||
See @url{http://code.google.com/p/game-music-emu/} for more information.
|
||||
|
||||
Some files have multiple tracks. The demuxer will pick the first track by
|
||||
default. The @option{track_index} option can be used to select a different
|
||||
track. Track indexes start at 0. The demuxer exports the number of tracks as
|
||||
@var{tracks} meta data entry.
|
||||
|
||||
For very large files, the @option{max_size} option may have to be adjusted.
|
||||
|
||||
@section gif
|
||||
|
||||
Animated GIF demuxer.
|
||||
@@ -428,49 +439,9 @@ ffmpeg -framerate 10 -pattern_type glob -i "*.png" out.mkv
|
||||
@end example
|
||||
@end itemize
|
||||
|
||||
@section libgme
|
||||
@section mov/mp4/3gp/Quicktme
|
||||
|
||||
The Game Music Emu library is a collection of video game music file emulators.
|
||||
|
||||
See @url{http://code.google.com/p/game-music-emu/} for more information.
|
||||
|
||||
Some files have multiple tracks. The demuxer will pick the first track by
|
||||
default. The @option{track_index} option can be used to select a different
|
||||
track. Track indexes start at 0. The demuxer exports the number of tracks as
|
||||
@var{tracks} meta data entry.
|
||||
|
||||
For very large files, the @option{max_size} option may have to be adjusted.
|
||||
|
||||
@section libopenmpt
|
||||
|
||||
libopenmpt based module demuxer
|
||||
|
||||
See @url{https://lib.openmpt.org/libopenmpt/} for more information.
|
||||
|
||||
Some files have multiple subsongs (tracks) this can be set with the @option{subsong}
|
||||
option.
|
||||
|
||||
It accepts the following options:
|
||||
|
||||
@table @option
|
||||
@item subsong
|
||||
Set the subsong index. This can be either 'all', 'auto', or the index of the
|
||||
subsong. Subsong indexes start at 0. The default is 'auto'.
|
||||
|
||||
The default value is to let libopenmpt choose.
|
||||
|
||||
@item layout
|
||||
Set the channel layout. Valid values are 1, 2, and 4 channel layouts.
|
||||
The default value is STEREO.
|
||||
|
||||
@item sample_rate
|
||||
Set the sample rate for libopenmpt to output.
|
||||
Range is from 1000 to INT_MAX. The value default is 48000.
|
||||
@end table
|
||||
|
||||
@section mov/mp4/3gp/QuickTime
|
||||
|
||||
QuickTime / MP4 demuxer.
|
||||
Quicktime / MP4 demuxer.
|
||||
|
||||
This demuxer accepts the following options:
|
||||
@table @option
|
||||
|
||||
@@ -246,8 +246,8 @@ For Emacs, add these roughly equivalent lines to your @file{.emacs.d/init.el}:
|
||||
|
||||
@section Development Policy
|
||||
|
||||
@subsection Patches/Committing
|
||||
@subheading Licenses for patches must be compatible with FFmpeg.
|
||||
@enumerate
|
||||
@item
|
||||
Contributions should be licensed under the
|
||||
@uref{http://www.gnu.org/licenses/lgpl-2.1.html, LGPL 2.1},
|
||||
including an "or any later version" clause, or, if you prefer
|
||||
@@ -260,15 +260,15 @@ preferred.
|
||||
If you add a new file, give it a proper license header. Do not copy and
|
||||
paste it from a random place, use an existing file as template.
|
||||
|
||||
@subheading You must not commit code which breaks FFmpeg!
|
||||
This means unfinished code which is enabled and breaks compilation,
|
||||
or compiles but does not work/breaks the regression tests. Code which
|
||||
is unfinished but disabled may be permitted under-circumstances, like
|
||||
missing samples or an implementation with a small subset of features.
|
||||
Always check the mailing list for any reviewers with issues and test
|
||||
FATE before you push.
|
||||
@item
|
||||
You must not commit code which breaks FFmpeg! (Meaning unfinished but
|
||||
enabled code which breaks compilation or compiles but does not work or
|
||||
breaks the regression tests)
|
||||
You can commit unfinished stuff (for testing etc), but it must be disabled
|
||||
(#ifdef etc) by default so it does not interfere with other developers'
|
||||
work.
|
||||
|
||||
@subheading Keep the main commit message short with an extended description below.
|
||||
@item
|
||||
The commit message should have a short first line in the form of
|
||||
a @samp{topic: short description} as a header, separated by a newline
|
||||
from the body consisting of an explanation of why the change is necessary.
|
||||
@@ -276,24 +276,30 @@ If the commit fixes a known bug on the bug tracker, the commit message
|
||||
should include its bug ID. Referring to the issue on the bug tracker does
|
||||
not exempt you from writing an excerpt of the bug in the commit message.
|
||||
|
||||
@subheading Testing must be adequate but not excessive.
|
||||
If it works for you, others, and passes FATE then it should be OK to commit
|
||||
it, provided it fits the other committing criteria. You should not worry about
|
||||
over-testing things. If your code has problems (portability, triggers
|
||||
compiler bugs, unusual environment etc) they will be reported and eventually
|
||||
fixed.
|
||||
@item
|
||||
You do not have to over-test things. If it works for you, and you think it
|
||||
should work for others, then commit. If your code has problems
|
||||
(portability, triggers compiler bugs, unusual environment etc) they will be
|
||||
reported and eventually fixed.
|
||||
|
||||
@subheading Do not commit unrelated changes together.
|
||||
They should be split them into self-contained pieces. Also do not forget
|
||||
that if part B depends on part A, but A does not depend on B, then A can
|
||||
and should be committed first and separate from B. Keeping changes well
|
||||
split into self-contained parts makes reviewing and understanding them on
|
||||
the commit log mailing list easier. This also helps in case of debugging
|
||||
later on.
|
||||
@item
|
||||
Do not commit unrelated changes together, split them into self-contained
|
||||
pieces. Also do not forget that if part B depends on part A, but A does not
|
||||
depend on B, then A can and should be committed first and separate from B.
|
||||
Keeping changes well split into self-contained parts makes reviewing and
|
||||
understanding them on the commit log mailing list easier. This also helps
|
||||
in case of debugging later on.
|
||||
Also if you have doubts about splitting or not splitting, do not hesitate to
|
||||
ask/discuss it on the developer mailing list.
|
||||
|
||||
@subheading Ask before you change the build system (configure, etc).
|
||||
@item
|
||||
Do not change behavior of the programs (renaming options etc) or public
|
||||
API or ABI without first discussing it on the ffmpeg-devel mailing list.
|
||||
Do not remove functionality from the code. Just improve!
|
||||
|
||||
Note: Redundant code can be removed.
|
||||
|
||||
@item
|
||||
Do not commit changes to the build system (Makefiles, configure script)
|
||||
which change behavior, defaults etc, without asking first. The same
|
||||
applies to compiler warning fixes, trivial looking fixes and to code
|
||||
@@ -302,7 +308,7 @@ the way we do. Send your changes as patches to the ffmpeg-devel mailing
|
||||
list, and if the code maintainers say OK, you may commit. This does not
|
||||
apply to files you wrote and/or maintain.
|
||||
|
||||
@subheading Cosmetic changes should be kept in separate patches.
|
||||
@item
|
||||
We refuse source indentation and other cosmetic changes if they are mixed
|
||||
with functional changes, such commits will be rejected and removed. Every
|
||||
developer has his own indentation style, you should not change it. Of course
|
||||
@@ -316,7 +322,7 @@ NOTE: If you had to put if()@{ .. @} over a large (> 5 lines) chunk of code,
|
||||
then either do NOT change the indentation of the inner part within (do not
|
||||
move it to the right)! or do so in a separate commit
|
||||
|
||||
@subheading Commit messages should always be filled out properly.
|
||||
@item
|
||||
Always fill out the commit log message. Describe in a few lines what you
|
||||
changed and why. You can refer to mailing list postings if you fix a
|
||||
particular bug. Comments such as "fixed!" or "Changed it." are unacceptable.
|
||||
@@ -328,31 +334,47 @@ area changed: Short 1 line description
|
||||
details describing what and why and giving references.
|
||||
@end example
|
||||
|
||||
@subheading Credit the author of the patch.
|
||||
@item
|
||||
Make sure the author of the commit is set correctly. (see git commit --author)
|
||||
If you apply a patch, send an
|
||||
answer to ffmpeg-devel (or wherever you got the patch from) saying that
|
||||
you applied the patch.
|
||||
|
||||
@subheading Complex patches should refer to discussion surrounding them.
|
||||
@item
|
||||
When applying patches that have been discussed (at length) on the mailing
|
||||
list, reference the thread in the log message.
|
||||
|
||||
@subheading Always wait long enough before pushing changes
|
||||
@item
|
||||
Do NOT commit to code actively maintained by others without permission.
|
||||
Send a patch to ffmpeg-devel. If no one answers within a reasonable
|
||||
time-frame (12h for build failures and security fixes, 3 days small changes,
|
||||
Send a patch to ffmpeg-devel instead. If no one answers within a reasonable
|
||||
timeframe (12h for build failures and security fixes, 3 days small changes,
|
||||
1 week for big patches) then commit your patch if you think it is OK.
|
||||
Also note, the maintainer can simply ask for more time to review!
|
||||
|
||||
@subsection Code
|
||||
@subheading API/ABI changes should be discussed before they are made.
|
||||
Do not change behavior of the programs (renaming options etc) or public
|
||||
API or ABI without first discussing it on the ffmpeg-devel mailing list.
|
||||
Do not remove widely used functionality or features (redundant code can be removed).
|
||||
@item
|
||||
Subscribe to the ffmpeg-cvslog mailing list. The diffs of all commits
|
||||
are sent there and reviewed by all the other developers. Bugs and possible
|
||||
improvements or general questions regarding commits are discussed there. We
|
||||
expect you to react if problems with your code are uncovered.
|
||||
|
||||
@subheading Remember to check if you need to bump versions for libav*.
|
||||
Depending on the change, you may need to change the version integer.
|
||||
@item
|
||||
Update the documentation if you change behavior or add features. If you are
|
||||
unsure how best to do this, send a patch to ffmpeg-devel, the documentation
|
||||
maintainer(s) will review and commit your stuff.
|
||||
|
||||
@item
|
||||
Try to keep important discussions and requests (also) on the public
|
||||
developer mailing list, so that all developers can benefit from them.
|
||||
|
||||
@item
|
||||
Never write to unallocated memory, never write over the end of arrays,
|
||||
always check values read from some untrusted source before using them
|
||||
as array index or other risky things.
|
||||
|
||||
@item
|
||||
Remember to check if you need to bump versions for the specific libav*
|
||||
parts (libavutil, libavcodec, libavformat) you are changing. You need
|
||||
to change the version integer.
|
||||
Incrementing the first component means no backward compatibility to
|
||||
previous versions (e.g. removal of a function from the public API).
|
||||
Incrementing the second component means backward compatible change
|
||||
@@ -362,7 +384,7 @@ Incrementing the third component means a noteworthy binary compatible
|
||||
change (e.g. encoder bug fix that matters for the decoder). The third
|
||||
component always starts at 100 to distinguish FFmpeg from Libav.
|
||||
|
||||
@subheading Warnings for correct code may be disabled if there is no other option.
|
||||
@item
|
||||
Compiler warnings indicate potential bugs or code with bad style. If a type of
|
||||
warning always points to correct and clean code, that warning should
|
||||
be disabled, not the code changed.
|
||||
@@ -371,65 +393,16 @@ If it is a bug, the bug has to be fixed. If it is not, the code should
|
||||
be changed to not generate a warning unless that causes a slowdown
|
||||
or obfuscates the code.
|
||||
|
||||
@subheading Check untrusted input properly.
|
||||
Never write to unallocated memory, never write over the end of arrays,
|
||||
always check values read from some untrusted source before using them
|
||||
as array index or other risky things.
|
||||
|
||||
@subsection Documentation/Other
|
||||
@subheading Subscribe to the ffmpeg-cvslog mailing list.
|
||||
It is important to do this as the diffs of all commits are sent there and
|
||||
reviewed by all the other developers. Bugs and possible improvements or
|
||||
general questions regarding commits are discussed there. We expect you to
|
||||
react if problems with your code are uncovered.
|
||||
|
||||
@subheading Keep the documentation up to date.
|
||||
Update the documentation if you change behavior or add features. If you are
|
||||
unsure how best to do this, send a patch to ffmpeg-devel, the documentation
|
||||
maintainer(s) will review and commit your stuff.
|
||||
|
||||
@subheading Important discussions should be accessible to all.
|
||||
Try to keep important discussions and requests (also) on the public
|
||||
developer mailing list, so that all developers can benefit from them.
|
||||
|
||||
@subheading Check your entries in MAINTAINERS.
|
||||
@item
|
||||
Make sure that no parts of the codebase that you maintain are missing from the
|
||||
@file{MAINTAINERS} file. If something that you want to maintain is missing add it with
|
||||
your name after it.
|
||||
If at some point you no longer want to maintain some code, then please help in
|
||||
finding a new maintainer and also don't forget to update the @file{MAINTAINERS} file.
|
||||
@end enumerate
|
||||
|
||||
We think our rules are not too hard. If you have comments, contact us.
|
||||
|
||||
@section Code of conduct
|
||||
|
||||
Be friendly and respectful towards others and third parties.
|
||||
Treat others the way you yourself want to be treated.
|
||||
|
||||
Be considerate. Not everyone shares the same viewpoint and priorities as you do.
|
||||
Different opinions and interpretations help the project.
|
||||
Looking at issues from a different perspective assists development.
|
||||
|
||||
Do not assume malice for things that can be attributed to incompetence. Even if
|
||||
it is malice, it's rarely good to start with that as initial assumption.
|
||||
|
||||
Stay friendly even if someone acts contrarily. Everyone has a bad day
|
||||
once in a while.
|
||||
If you yourself have a bad day or are angry then try to take a break and reply
|
||||
once you are calm and without anger if you have to.
|
||||
|
||||
Try to help other team members and cooperate if you can.
|
||||
|
||||
The goal of software development is to create technical excellence, not for any
|
||||
individual to be better and "win" against the others. Large software projects
|
||||
are only possible and successful through teamwork.
|
||||
|
||||
If someone struggles do not put them down. Give them a helping hand
|
||||
instead and point them in the right direction.
|
||||
|
||||
Finally, keep in mind the immortal words of Bill and Ted,
|
||||
"Be excellent to each other."
|
||||
|
||||
@anchor{Submitting patches}
|
||||
@section Submitting patches
|
||||
|
||||
@@ -464,11 +437,7 @@ Patches should be posted to the
|
||||
mailing list. Use @code{git send-email} when possible since it will properly
|
||||
send patches without requiring extra care. If you cannot, then send patches
|
||||
as base64-encoded attachments, so your patch is not trashed during
|
||||
transmission. Also ensure the correct mime type is used
|
||||
(text/x-diff or text/x-patch or at least text/plain) and that only one
|
||||
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.
|
||||
transmission.
|
||||
|
||||
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
|
||||
|
||||
1
doc/doxy/.gitignore
vendored
1
doc/doxy/.gitignore
vendored
@@ -1 +0,0 @@
|
||||
/html/
|
||||
@@ -61,9 +61,8 @@ Two loop searching (TLS) 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
|
||||
all quantizers and adjusting some individual quantizer a little. Will tune
|
||||
itself based on whether @option{aac_is}, @option{aac_ms} and @option{aac_pns}
|
||||
are enabled.
|
||||
all quantizers and adjusting some individual quantizer a little.
|
||||
Will tune itself based on whether aac_is/aac_ms/aac_pns are enabled.
|
||||
This is the default choice for a coder.
|
||||
|
||||
@item anmr
|
||||
@@ -85,7 +84,7 @@ Not recommended.
|
||||
@end table
|
||||
|
||||
@item aac_ms
|
||||
Sets mid/side coding mode. The default value of "auto" will automatically use
|
||||
Sets mid/side coding mode. The default value of auto will automatically use
|
||||
M/S with bands which will benefit from such coding. Can be forced for all bands
|
||||
using the value "enable", which is mainly useful for debugging or disabled using
|
||||
"disable".
|
||||
@@ -131,20 +130,20 @@ The default, AAC "Low-complexity" profile. Is the most compatible and produces
|
||||
decent quality.
|
||||
|
||||
@item mpeg2_aac_low
|
||||
Equivalent to @code{-profile:a aac_low -aac_pns 0}. PNS was introduced with the
|
||||
MPEG4 specifications.
|
||||
Equivalent to -profile:a aac_low -aac_pns 0. PNS was introduced with the MPEG4
|
||||
specifications.
|
||||
|
||||
@item aac_ltp
|
||||
Long term prediction profile, is enabled by and will enable the @option{aac_ltp}
|
||||
option. Introduced in MPEG4.
|
||||
Long term prediction profile, is enabled by and will enable the aac_ltp option.
|
||||
Introduced in MPEG4.
|
||||
|
||||
@item aac_main
|
||||
Main-type prediction profile, is enabled by and will enable the @option{aac_pred}
|
||||
option. Introduced in MPEG2.
|
||||
Main-type prediction profile, is enabled by and will enable the aac_pred option.
|
||||
Introduced in MPEG2.
|
||||
|
||||
@end table
|
||||
If this option is unspecified it is set to @samp{aac_low}.
|
||||
@end table
|
||||
@end table
|
||||
|
||||
@section ac3 and ac3_fixed
|
||||
|
||||
@@ -612,6 +611,111 @@ and slightly improves compression.
|
||||
|
||||
@end table
|
||||
|
||||
@anchor{libfaac}
|
||||
@section libfaac
|
||||
|
||||
libfaac AAC (Advanced Audio Coding) encoder wrapper.
|
||||
|
||||
This encoder is of much lower quality and is more unstable than any other AAC
|
||||
encoders, so it's highly recommended to instead use other encoders, like
|
||||
@ref{aacenc,,the native FFmpeg AAC encoder}.
|
||||
|
||||
This encoder also requires the presence of the libfaac headers and library
|
||||
during configuration. You need to explicitly configure the build with
|
||||
@code{--enable-libfaac --enable-nonfree}.
|
||||
|
||||
@subsection Options
|
||||
|
||||
The following shared FFmpeg codec options are recognized.
|
||||
|
||||
The following options are supported by the libfaac wrapper. The
|
||||
@command{faac}-equivalent of the options are listed in parentheses.
|
||||
|
||||
@table @option
|
||||
@item b (@emph{-b})
|
||||
Set bit rate in bits/s for ABR (Average Bit Rate) mode. If the bit rate
|
||||
is not explicitly specified, it is automatically set to a suitable
|
||||
value depending on the selected profile. @command{faac} bitrate is
|
||||
expressed in kilobits/s.
|
||||
|
||||
Note that libfaac does not support CBR (Constant Bit Rate) but only
|
||||
ABR (Average Bit Rate).
|
||||
|
||||
If VBR mode is enabled this option is ignored.
|
||||
|
||||
@item ar (@emph{-R})
|
||||
Set audio sampling rate (in Hz).
|
||||
|
||||
@item ac (@emph{-c})
|
||||
Set the number of audio channels.
|
||||
|
||||
@item cutoff (@emph{-C})
|
||||
Set cutoff frequency. If not specified (or explicitly set to 0) it
|
||||
will use a value automatically computed by the library. Default value
|
||||
is 0.
|
||||
|
||||
@item profile
|
||||
Set audio profile.
|
||||
|
||||
The following profiles are recognized:
|
||||
@table @samp
|
||||
@item aac_main
|
||||
Main AAC (Main)
|
||||
|
||||
@item aac_low
|
||||
Low Complexity AAC (LC)
|
||||
|
||||
@item aac_ssr
|
||||
Scalable Sample Rate (SSR)
|
||||
|
||||
@item aac_ltp
|
||||
Long Term Prediction (LTP)
|
||||
@end table
|
||||
|
||||
If not specified it is set to @samp{aac_low}.
|
||||
|
||||
@item flags +qscale
|
||||
Set constant quality VBR (Variable Bit Rate) mode.
|
||||
|
||||
@item global_quality
|
||||
Set quality in VBR mode as an integer number of lambda units.
|
||||
|
||||
Only relevant when VBR mode is enabled with @code{flags +qscale}. The
|
||||
value is converted to QP units by dividing it by @code{FF_QP2LAMBDA},
|
||||
and used to set the quality value used by libfaac. A reasonable range
|
||||
for the option value in QP units is [10-500], the higher the value the
|
||||
higher the quality.
|
||||
|
||||
@item q (@emph{-q})
|
||||
Enable VBR mode when set to a non-negative value, and set constant
|
||||
quality value as a double floating point value in QP units.
|
||||
|
||||
The value sets the quality value used by libfaac. A reasonable range
|
||||
for the option value is [10-500], the higher the value the higher the
|
||||
quality.
|
||||
|
||||
This option is valid only using the @command{ffmpeg} command-line
|
||||
tool. For library interface users, use @option{global_quality}.
|
||||
@end table
|
||||
|
||||
@subsection Examples
|
||||
|
||||
@itemize
|
||||
@item
|
||||
Use @command{ffmpeg} to convert an audio file to ABR 128 kbps AAC in an M4A (MP4)
|
||||
container:
|
||||
@example
|
||||
ffmpeg -i input.wav -codec:a libfaac -b:a 128k -output.m4a
|
||||
@end example
|
||||
|
||||
@item
|
||||
Use @command{ffmpeg} to convert an audio file to VBR AAC, using the
|
||||
LTP AAC profile:
|
||||
@example
|
||||
ffmpeg -i input.wav -c:a libfaac -profile:a aac_ltp -q:a 100 output.m4a
|
||||
@end example
|
||||
@end itemize
|
||||
|
||||
@anchor{libfdk-aac-enc}
|
||||
@section libfdk_aac
|
||||
|
||||
@@ -1080,17 +1184,6 @@ following: 4000, 6000, 8000, 12000, or 20000, corresponding to
|
||||
narrowband, mediumband, wideband, super wideband, and fullband
|
||||
respectively. The default is 0 (cutoff disabled).
|
||||
|
||||
@item mapping_family (@emph{mapping_family})
|
||||
Set channel mapping family to be used by the encoder. The default value of -1
|
||||
uses mapping family 0 for mono and stereo inputs, and mapping family 1
|
||||
otherwise. The default also disables the surround masking and LFE bandwidth
|
||||
optimzations in libopus, and requires that the input contains 8 channels or
|
||||
fewer.
|
||||
|
||||
Other values include 0 for mono and stereo, 1 for surround sound with masking
|
||||
and LFE bandwidth optimizations, and 255 for independent streams with an
|
||||
unspecified channel layout.
|
||||
|
||||
@end table
|
||||
|
||||
@section libvorbis
|
||||
@@ -1297,7 +1390,7 @@ is 0. This is only used when @option{slice_mode} is set to
|
||||
@samp{fixed}.
|
||||
|
||||
@item slice_mode
|
||||
Set slice mode. Can assume one of the following possible values:
|
||||
Set slice mode. Can assume one of the follwing possible values:
|
||||
|
||||
@table @samp
|
||||
@item fixed
|
||||
@@ -1773,7 +1866,7 @@ Enable CAVLC and disable CABAC. It generates the same effect as
|
||||
@end table
|
||||
|
||||
@item cmp
|
||||
Set full pixel motion estimation comparison algorithm. Possible values:
|
||||
Set full pixel motion estimation comparation algorithm. Possible values:
|
||||
|
||||
@table @samp
|
||||
@item chroma
|
||||
@@ -2004,7 +2097,7 @@ ffmpeg -i foo.mpg -vcodec libx264 -x264opts keyint=123:min-keyint=20 -an out.mkv
|
||||
|
||||
@item a53cc @var{boolean}
|
||||
Import closed captions (which must be ATSC compatible format) into output.
|
||||
Only the mpeg2 and h264 decoders provide these. Default is 1 (on).
|
||||
Only the mpeg2 and h264 decoders provide these. Default is 0 (off).
|
||||
|
||||
@item x264-params (N.A.)
|
||||
Override the x264 configuration using a :-separated list of key=value
|
||||
|
||||
18
doc/examples/.gitignore
vendored
18
doc/examples/.gitignore
vendored
@@ -1,18 +0,0 @@
|
||||
/avio_dir_cmd
|
||||
/avio_reading
|
||||
/decoding_encoding
|
||||
/demuxing_decoding
|
||||
/extract_mvs
|
||||
/filter_audio
|
||||
/filtering_audio
|
||||
/filtering_video
|
||||
/http_multiclient
|
||||
/metadata
|
||||
/muxing
|
||||
/pc-uninstalled
|
||||
/qsvdec
|
||||
/remuxing
|
||||
/resampling_audio
|
||||
/scaling_video
|
||||
/transcode_aac
|
||||
/transcoding
|
||||
@@ -25,9 +25,9 @@
|
||||
* libavcodec API use example.
|
||||
*
|
||||
* @example decoding_encoding.c
|
||||
* Note that libavcodec only handles codecs (MPEG, MPEG-4, etc...),
|
||||
* not file formats (AVI, VOB, MP4, MOV, MKV, MXF, FLV, MPEG-TS, MPEG-PS, etc...).
|
||||
* See library 'libavformat' for the format handling
|
||||
* Note that libavcodec only handles codecs (mpeg, mpeg4, etc...),
|
||||
* not file formats (avi, vob, mp4, mov, mkv, mxf, flv, mpegts, mpegps, etc...). See library 'libavformat' for the
|
||||
* format handling
|
||||
*/
|
||||
|
||||
#include <math.h>
|
||||
@@ -253,7 +253,7 @@ static void audio_decode_example(const char *outfilename, const char *filename)
|
||||
|
||||
printf("Decode audio file %s to %s\n", filename, outfilename);
|
||||
|
||||
/* find the MPEG audio decoder */
|
||||
/* find the mpeg audio decoder */
|
||||
codec = avcodec_find_decoder(AV_CODEC_ID_MP2);
|
||||
if (!codec) {
|
||||
fprintf(stderr, "Codec not found\n");
|
||||
@@ -356,7 +356,7 @@ static void video_encode_example(const char *filename, int codec_id)
|
||||
|
||||
printf("Encode video file %s\n", filename);
|
||||
|
||||
/* find the video encoder */
|
||||
/* find the mpeg1 video encoder */
|
||||
codec = avcodec_find_encoder(codec_id);
|
||||
if (!codec) {
|
||||
fprintf(stderr, "Codec not found\n");
|
||||
@@ -475,7 +475,7 @@ static void video_encode_example(const char *filename, int codec_id)
|
||||
}
|
||||
}
|
||||
|
||||
/* add sequence end code to have a real MPEG file */
|
||||
/* add sequence end code to have a real mpeg file */
|
||||
fwrite(endcode, 1, sizeof(endcode), f);
|
||||
fclose(f);
|
||||
|
||||
@@ -543,12 +543,12 @@ static void video_decode_example(const char *outfilename, const char *filename)
|
||||
|
||||
av_init_packet(&avpkt);
|
||||
|
||||
/* set end of buffer to 0 (this ensures that no overreading happens for damaged MPEG streams) */
|
||||
/* set end of buffer to 0 (this ensures that no overreading happens for damaged mpeg streams) */
|
||||
memset(inbuf + INBUF_SIZE, 0, AV_INPUT_BUFFER_PADDING_SIZE);
|
||||
|
||||
printf("Decode video file %s to %s\n", filename, outfilename);
|
||||
|
||||
/* find the MPEG-1 video decoder */
|
||||
/* find the mpeg1 video decoder */
|
||||
codec = avcodec_find_decoder(AV_CODEC_ID_MPEG1VIDEO);
|
||||
if (!codec) {
|
||||
fprintf(stderr, "Codec not found\n");
|
||||
@@ -613,9 +613,9 @@ static void video_decode_example(const char *outfilename, const char *filename)
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/* Some codecs, such as MPEG, transmit the I- and P-frame with a
|
||||
/* some codecs, such as MPEG, transmit the I and P frame with a
|
||||
latency of one frame. You must do the following to have a
|
||||
chance to get the last frame of the video. */
|
||||
chance to get the last frame of the video */
|
||||
avpkt.data = NULL;
|
||||
avpkt.size = 0;
|
||||
decode_write_frame(outfilename, c, frame, &frame_count, &avpkt, 1);
|
||||
|
||||
@@ -93,9 +93,10 @@ static int decode_packet(int *got_frame, int cached)
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("video_frame%s n:%d coded_n:%d\n",
|
||||
printf("video_frame%s n:%d coded_n:%d pts:%s\n",
|
||||
cached ? "(cached)" : "",
|
||||
video_frame_count++, frame->coded_picture_number);
|
||||
video_frame_count++, frame->coded_picture_number,
|
||||
av_ts2timestr(frame->pts, &video_dec_ctx->time_base));
|
||||
|
||||
/* copy decoded frame to destination buffer:
|
||||
* this is required since rawvideo expects non aligned data */
|
||||
@@ -147,10 +148,11 @@ static int decode_packet(int *got_frame, int cached)
|
||||
}
|
||||
|
||||
static int open_codec_context(int *stream_idx,
|
||||
AVCodecContext **dec_ctx, AVFormatContext *fmt_ctx, enum AVMediaType type)
|
||||
AVFormatContext *fmt_ctx, enum AVMediaType type)
|
||||
{
|
||||
int ret, stream_index;
|
||||
AVStream *st;
|
||||
AVCodecContext *dec_ctx = NULL;
|
||||
AVCodec *dec = NULL;
|
||||
AVDictionary *opts = NULL;
|
||||
|
||||
@@ -164,31 +166,17 @@ static int open_codec_context(int *stream_idx,
|
||||
st = fmt_ctx->streams[stream_index];
|
||||
|
||||
/* find decoder for the stream */
|
||||
dec = avcodec_find_decoder(st->codecpar->codec_id);
|
||||
dec_ctx = st->codec;
|
||||
dec = avcodec_find_decoder(dec_ctx->codec_id);
|
||||
if (!dec) {
|
||||
fprintf(stderr, "Failed to find %s codec\n",
|
||||
av_get_media_type_string(type));
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
|
||||
/* Allocate a codec context for the decoder */
|
||||
*dec_ctx = avcodec_alloc_context3(dec);
|
||||
if (!*dec_ctx) {
|
||||
fprintf(stderr, "Failed to allocate the %s codec context\n",
|
||||
av_get_media_type_string(type));
|
||||
return AVERROR(ENOMEM);
|
||||
}
|
||||
|
||||
/* Copy codec parameters from input stream to output codec context */
|
||||
if ((ret = avcodec_parameters_to_context(*dec_ctx, st->codecpar)) < 0) {
|
||||
fprintf(stderr, "Failed to copy %s codec parameters to decoder context\n",
|
||||
av_get_media_type_string(type));
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Init the decoders, with or without reference counting */
|
||||
av_dict_set(&opts, "refcounted_frames", refcount ? "1" : "0", 0);
|
||||
if ((ret = avcodec_open2(*dec_ctx, dec, &opts)) < 0) {
|
||||
if ((ret = avcodec_open2(dec_ctx, dec, &opts)) < 0) {
|
||||
fprintf(stderr, "Failed to open %s codec\n",
|
||||
av_get_media_type_string(type));
|
||||
return ret;
|
||||
@@ -267,8 +255,9 @@ int main (int argc, char **argv)
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (open_codec_context(&video_stream_idx, &video_dec_ctx, fmt_ctx, AVMEDIA_TYPE_VIDEO) >= 0) {
|
||||
if (open_codec_context(&video_stream_idx, fmt_ctx, AVMEDIA_TYPE_VIDEO) >= 0) {
|
||||
video_stream = fmt_ctx->streams[video_stream_idx];
|
||||
video_dec_ctx = video_stream->codec;
|
||||
|
||||
video_dst_file = fopen(video_dst_filename, "wb");
|
||||
if (!video_dst_file) {
|
||||
@@ -290,8 +279,9 @@ int main (int argc, char **argv)
|
||||
video_dst_bufsize = ret;
|
||||
}
|
||||
|
||||
if (open_codec_context(&audio_stream_idx, &audio_dec_ctx, fmt_ctx, AVMEDIA_TYPE_AUDIO) >= 0) {
|
||||
if (open_codec_context(&audio_stream_idx, fmt_ctx, AVMEDIA_TYPE_AUDIO) >= 0) {
|
||||
audio_stream = fmt_ctx->streams[audio_stream_idx];
|
||||
audio_dec_ctx = audio_stream->codec;
|
||||
audio_dst_file = fopen(audio_dst_filename, "wb");
|
||||
if (!audio_dst_file) {
|
||||
fprintf(stderr, "Could not open destination file %s\n", audio_dst_filename);
|
||||
@@ -379,8 +369,8 @@ int main (int argc, char **argv)
|
||||
}
|
||||
|
||||
end:
|
||||
avcodec_free_context(&video_dec_ctx);
|
||||
avcodec_free_context(&audio_dec_ctx);
|
||||
avcodec_close(video_dec_ctx);
|
||||
avcodec_close(audio_dec_ctx);
|
||||
avformat_close_input(&fmt_ctx);
|
||||
if (video_dst_file)
|
||||
fclose(video_dst_file);
|
||||
|
||||
@@ -65,7 +65,7 @@ static int open_input_file(const char *filename)
|
||||
/* select the audio stream */
|
||||
ret = av_find_best_stream(fmt_ctx, AVMEDIA_TYPE_AUDIO, -1, -1, &dec, 0);
|
||||
if (ret < 0) {
|
||||
av_log(NULL, AV_LOG_ERROR, "Cannot find an audio stream in the input file\n");
|
||||
av_log(NULL, AV_LOG_ERROR, "Cannot find a audio stream in the input file\n");
|
||||
return ret;
|
||||
}
|
||||
audio_stream_index = ret;
|
||||
|
||||
@@ -33,12 +33,12 @@
|
||||
#include <libavutil/opt.h>
|
||||
#include <unistd.h>
|
||||
|
||||
static void process_client(AVIOContext *client, const char *in_uri)
|
||||
void process_client(AVIOContext *client, const char *in_uri)
|
||||
{
|
||||
AVIOContext *input = NULL;
|
||||
uint8_t buf[1024];
|
||||
int ret, n, reply_code;
|
||||
uint8_t *resource = NULL;
|
||||
char *resource = NULL;
|
||||
while ((ret = avio_handshake(client)) > 0) {
|
||||
av_opt_get(client, "resource", AV_OPT_SEARCH_CHILDREN, &resource);
|
||||
// check for strlen(resource) is necessary, because av_opt_get()
|
||||
@@ -97,11 +97,11 @@ end:
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
av_log_set_level(AV_LOG_TRACE);
|
||||
AVDictionary *options = NULL;
|
||||
AVIOContext *client = NULL, *server = NULL;
|
||||
const char *in_uri, *out_uri;
|
||||
int ret, pid;
|
||||
av_log_set_level(AV_LOG_TRACE);
|
||||
if (argc < 3) {
|
||||
printf("usage: %s input http://hostname[:port]\n"
|
||||
"API example program to serve http to multiple clients.\n"
|
||||
|
||||
@@ -52,7 +52,6 @@
|
||||
// a wrapper around a single output AVStream
|
||||
typedef struct OutputStream {
|
||||
AVStream *st;
|
||||
AVCodecContext *enc;
|
||||
|
||||
/* pts of the next frame that will be generated */
|
||||
int64_t next_pts;
|
||||
@@ -105,18 +104,13 @@ static void add_stream(OutputStream *ost, AVFormatContext *oc,
|
||||
exit(1);
|
||||
}
|
||||
|
||||
ost->st = avformat_new_stream(oc, NULL);
|
||||
ost->st = avformat_new_stream(oc, *codec);
|
||||
if (!ost->st) {
|
||||
fprintf(stderr, "Could not allocate stream\n");
|
||||
exit(1);
|
||||
}
|
||||
ost->st->id = oc->nb_streams-1;
|
||||
c = avcodec_alloc_context3(*codec);
|
||||
if (!c) {
|
||||
fprintf(stderr, "Could not alloc an encoding context\n");
|
||||
exit(1);
|
||||
}
|
||||
ost->enc = c;
|
||||
c = ost->st->codec;
|
||||
|
||||
switch ((*codec)->type) {
|
||||
case AVMEDIA_TYPE_AUDIO:
|
||||
@@ -161,7 +155,7 @@ static void add_stream(OutputStream *ost, AVFormatContext *oc,
|
||||
c->gop_size = 12; /* emit one intra frame every twelve frames at most */
|
||||
c->pix_fmt = STREAM_PIX_FMT;
|
||||
if (c->codec_id == AV_CODEC_ID_MPEG2VIDEO) {
|
||||
/* just for testing, we also add B-frames */
|
||||
/* just for testing, we also add B frames */
|
||||
c->max_b_frames = 2;
|
||||
}
|
||||
if (c->codec_id == AV_CODEC_ID_MPEG1VIDEO) {
|
||||
@@ -219,7 +213,7 @@ static void open_audio(AVFormatContext *oc, AVCodec *codec, OutputStream *ost, A
|
||||
int ret;
|
||||
AVDictionary *opt = NULL;
|
||||
|
||||
c = ost->enc;
|
||||
c = ost->st->codec;
|
||||
|
||||
/* open it */
|
||||
av_dict_copy(&opt, opt_arg, 0);
|
||||
@@ -246,13 +240,6 @@ static void open_audio(AVFormatContext *oc, AVCodec *codec, OutputStream *ost, A
|
||||
ost->tmp_frame = alloc_audio_frame(AV_SAMPLE_FMT_S16, c->channel_layout,
|
||||
c->sample_rate, nb_samples);
|
||||
|
||||
/* copy the stream parameters to the muxer */
|
||||
ret = avcodec_parameters_from_context(ost->st->codecpar, c);
|
||||
if (ret < 0) {
|
||||
fprintf(stderr, "Could not copy the stream parameters\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/* create resampler context */
|
||||
ost->swr_ctx = swr_alloc();
|
||||
if (!ost->swr_ctx) {
|
||||
@@ -284,13 +271,13 @@ static AVFrame *get_audio_frame(OutputStream *ost)
|
||||
int16_t *q = (int16_t*)frame->data[0];
|
||||
|
||||
/* check if we want to generate more frames */
|
||||
if (av_compare_ts(ost->next_pts, ost->enc->time_base,
|
||||
if (av_compare_ts(ost->next_pts, ost->st->codec->time_base,
|
||||
STREAM_DURATION, (AVRational){ 1, 1 }) >= 0)
|
||||
return NULL;
|
||||
|
||||
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->st->codec->channels; i++)
|
||||
*q++ = v;
|
||||
ost->t += ost->tincr;
|
||||
ost->tincr += ost->tincr2;
|
||||
@@ -316,7 +303,7 @@ static int write_audio_frame(AVFormatContext *oc, OutputStream *ost)
|
||||
int dst_nb_samples;
|
||||
|
||||
av_init_packet(&pkt);
|
||||
c = ost->enc;
|
||||
c = ost->st->codec;
|
||||
|
||||
frame = get_audio_frame(ost);
|
||||
|
||||
@@ -396,7 +383,7 @@ static AVFrame *alloc_picture(enum AVPixelFormat pix_fmt, int width, int height)
|
||||
static void open_video(AVFormatContext *oc, AVCodec *codec, OutputStream *ost, AVDictionary *opt_arg)
|
||||
{
|
||||
int ret;
|
||||
AVCodecContext *c = ost->enc;
|
||||
AVCodecContext *c = ost->st->codec;
|
||||
AVDictionary *opt = NULL;
|
||||
|
||||
av_dict_copy(&opt, opt_arg, 0);
|
||||
@@ -427,13 +414,6 @@ static void open_video(AVFormatContext *oc, AVCodec *codec, OutputStream *ost, A
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
/* copy the stream parameters to the muxer */
|
||||
ret = avcodec_parameters_from_context(ost->st->codecpar, c);
|
||||
if (ret < 0) {
|
||||
fprintf(stderr, "Could not copy the stream parameters\n");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
/* Prepare a dummy image. */
|
||||
@@ -468,10 +448,10 @@ static void fill_yuv_image(AVFrame *pict, int frame_index,
|
||||
|
||||
static AVFrame *get_video_frame(OutputStream *ost)
|
||||
{
|
||||
AVCodecContext *c = ost->enc;
|
||||
AVCodecContext *c = ost->st->codec;
|
||||
|
||||
/* check if we want to generate more frames */
|
||||
if (av_compare_ts(ost->next_pts, c->time_base,
|
||||
if (av_compare_ts(ost->next_pts, ost->st->codec->time_base,
|
||||
STREAM_DURATION, (AVRational){ 1, 1 }) >= 0)
|
||||
return NULL;
|
||||
|
||||
@@ -515,7 +495,7 @@ static int write_video_frame(AVFormatContext *oc, OutputStream *ost)
|
||||
int got_packet = 0;
|
||||
AVPacket pkt = { 0 };
|
||||
|
||||
c = ost->enc;
|
||||
c = ost->st->codec;
|
||||
|
||||
frame = get_video_frame(ost);
|
||||
|
||||
@@ -544,7 +524,7 @@ static int write_video_frame(AVFormatContext *oc, OutputStream *ost)
|
||||
|
||||
static void close_stream(AVFormatContext *oc, OutputStream *ost)
|
||||
{
|
||||
avcodec_free_context(&ost->enc);
|
||||
avcodec_close(ost->st->codec);
|
||||
av_frame_free(&ost->frame);
|
||||
av_frame_free(&ost->tmp_frame);
|
||||
sws_freeContext(ost->sws_ctx);
|
||||
@@ -565,7 +545,6 @@ int main(int argc, char **argv)
|
||||
int have_video = 0, have_audio = 0;
|
||||
int encode_video = 0, encode_audio = 0;
|
||||
AVDictionary *opt = NULL;
|
||||
int i;
|
||||
|
||||
/* Initialize libavcodec, and register all codecs and formats. */
|
||||
av_register_all();
|
||||
@@ -582,9 +561,8 @@ int main(int argc, char **argv)
|
||||
}
|
||||
|
||||
filename = argv[1];
|
||||
for (i = 2; i+1 < argc; i+=2) {
|
||||
if (!strcmp(argv[i], "-flags") || !strcmp(argv[i], "-fflags"))
|
||||
av_dict_set(&opt, argv[i]+1, argv[i+1], 0);
|
||||
if (argc > 3 && !strcmp(argv[2], "-flags")) {
|
||||
av_dict_set(&opt, argv[2]+1, argv[3], 0);
|
||||
}
|
||||
|
||||
/* allocate the output media context */
|
||||
@@ -642,8 +620,8 @@ int main(int argc, char **argv)
|
||||
while (encode_video || encode_audio) {
|
||||
/* select the stream to encode */
|
||||
if (encode_video &&
|
||||
(!encode_audio || av_compare_ts(video_st.next_pts, video_st.enc->time_base,
|
||||
audio_st.next_pts, audio_st.enc->time_base) <= 0)) {
|
||||
(!encode_audio || av_compare_ts(video_st.next_pts, video_st.st->codec->time_base,
|
||||
audio_st.next_pts, audio_st.st->codec->time_base) <= 0)) {
|
||||
encode_video = !write_video_frame(oc, &video_st);
|
||||
} else {
|
||||
encode_audio = !write_audio_frame(oc, &audio_st);
|
||||
|
||||
@@ -352,7 +352,7 @@ int main(int argc, char **argv)
|
||||
for (i = 0; i < input_ctx->nb_streams; i++) {
|
||||
AVStream *st = input_ctx->streams[i];
|
||||
|
||||
if (st->codecpar->codec_id == AV_CODEC_ID_H264 && !video_st)
|
||||
if (st->codec->codec_id == AV_CODEC_ID_H264 && !video_st)
|
||||
video_st = st;
|
||||
else
|
||||
st->discard = AVDISCARD_ALL;
|
||||
@@ -404,16 +404,16 @@ int main(int argc, char **argv)
|
||||
goto finish;
|
||||
}
|
||||
decoder_ctx->codec_id = AV_CODEC_ID_H264;
|
||||
if (video_st->codecpar->extradata_size) {
|
||||
decoder_ctx->extradata = av_mallocz(video_st->codecpar->extradata_size +
|
||||
if (video_st->codec->extradata_size) {
|
||||
decoder_ctx->extradata = av_mallocz(video_st->codec->extradata_size +
|
||||
AV_INPUT_BUFFER_PADDING_SIZE);
|
||||
if (!decoder_ctx->extradata) {
|
||||
ret = AVERROR(ENOMEM);
|
||||
goto finish;
|
||||
}
|
||||
memcpy(decoder_ctx->extradata, video_st->codecpar->extradata,
|
||||
video_st->codecpar->extradata_size);
|
||||
decoder_ctx->extradata_size = video_st->codecpar->extradata_size;
|
||||
memcpy(decoder_ctx->extradata, video_st->codec->extradata,
|
||||
video_st->codec->extradata_size);
|
||||
decoder_ctx->extradata_size = video_st->codec->extradata_size;
|
||||
}
|
||||
decoder_ctx->refcounted_frames = 1;
|
||||
|
||||
|
||||
@@ -62,7 +62,6 @@ static int open_input_file(const char *filename,
|
||||
AVFormatContext **input_format_context,
|
||||
AVCodecContext **input_codec_context)
|
||||
{
|
||||
AVCodecContext *avctx;
|
||||
AVCodec *input_codec;
|
||||
int error;
|
||||
|
||||
@@ -92,39 +91,23 @@ static int open_input_file(const char *filename,
|
||||
}
|
||||
|
||||
/** 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((*input_format_context)->streams[0]->codec->codec_id))) {
|
||||
fprintf(stderr, "Could not find input codec\n");
|
||||
avformat_close_input(input_format_context);
|
||||
return AVERROR_EXIT;
|
||||
}
|
||||
|
||||
/** allocate a new decoding context */
|
||||
avctx = avcodec_alloc_context3(input_codec);
|
||||
if (!avctx) {
|
||||
fprintf(stderr, "Could not allocate a decoding context\n");
|
||||
avformat_close_input(input_format_context);
|
||||
return AVERROR(ENOMEM);
|
||||
}
|
||||
|
||||
/** initialize the stream parameters with demuxer information */
|
||||
error = avcodec_parameters_to_context(avctx, (*input_format_context)->streams[0]->codecpar);
|
||||
if (error < 0) {
|
||||
avformat_close_input(input_format_context);
|
||||
avcodec_free_context(&avctx);
|
||||
return error;
|
||||
}
|
||||
|
||||
/** Open the decoder for the audio stream to use it later. */
|
||||
if ((error = avcodec_open2(avctx, input_codec, NULL)) < 0) {
|
||||
if ((error = avcodec_open2((*input_format_context)->streams[0]->codec,
|
||||
input_codec, NULL)) < 0) {
|
||||
fprintf(stderr, "Could not open input codec (error '%s')\n",
|
||||
get_error_text(error));
|
||||
avcodec_free_context(&avctx);
|
||||
avformat_close_input(input_format_context);
|
||||
return error;
|
||||
}
|
||||
|
||||
/** Save the decoder context for easier access later. */
|
||||
*input_codec_context = avctx;
|
||||
*input_codec_context = (*input_format_context)->streams[0]->codec;
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -139,7 +122,6 @@ static int open_output_file(const char *filename,
|
||||
AVFormatContext **output_format_context,
|
||||
AVCodecContext **output_codec_context)
|
||||
{
|
||||
AVCodecContext *avctx = NULL;
|
||||
AVIOContext *output_io_context = NULL;
|
||||
AVStream *stream = NULL;
|
||||
AVCodec *output_codec = NULL;
|
||||
@@ -179,31 +161,27 @@ static int open_output_file(const char *filename,
|
||||
}
|
||||
|
||||
/** Create a new audio stream in the output file container. */
|
||||
if (!(stream = avformat_new_stream(*output_format_context, NULL))) {
|
||||
if (!(stream = avformat_new_stream(*output_format_context, output_codec))) {
|
||||
fprintf(stderr, "Could not create new stream\n");
|
||||
error = AVERROR(ENOMEM);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
avctx = avcodec_alloc_context3(output_codec);
|
||||
if (!avctx) {
|
||||
fprintf(stderr, "Could not allocate an encoding context\n");
|
||||
error = AVERROR(ENOMEM);
|
||||
goto cleanup;
|
||||
}
|
||||
/** Save the encoder context for easier access later. */
|
||||
*output_codec_context = stream->codec;
|
||||
|
||||
/**
|
||||
* 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);
|
||||
avctx->sample_rate = input_codec_context->sample_rate;
|
||||
avctx->sample_fmt = output_codec->sample_fmts[0];
|
||||
avctx->bit_rate = OUTPUT_BIT_RATE;
|
||||
(*output_codec_context)->channels = OUTPUT_CHANNELS;
|
||||
(*output_codec_context)->channel_layout = av_get_default_channel_layout(OUTPUT_CHANNELS);
|
||||
(*output_codec_context)->sample_rate = input_codec_context->sample_rate;
|
||||
(*output_codec_context)->sample_fmt = output_codec->sample_fmts[0];
|
||||
(*output_codec_context)->bit_rate = OUTPUT_BIT_RATE;
|
||||
|
||||
/** Allow the use of the experimental AAC encoder */
|
||||
avctx->strict_std_compliance = FF_COMPLIANCE_EXPERIMENTAL;
|
||||
(*output_codec_context)->strict_std_compliance = FF_COMPLIANCE_EXPERIMENTAL;
|
||||
|
||||
/** Set the sample rate for the container. */
|
||||
stream->time_base.den = input_codec_context->sample_rate;
|
||||
@@ -214,28 +192,18 @@ static int open_output_file(const char *filename,
|
||||
* Mark the encoder so that it behaves accordingly.
|
||||
*/
|
||||
if ((*output_format_context)->oformat->flags & AVFMT_GLOBALHEADER)
|
||||
avctx->flags |= AV_CODEC_FLAG_GLOBAL_HEADER;
|
||||
(*output_codec_context)->flags |= AV_CODEC_FLAG_GLOBAL_HEADER;
|
||||
|
||||
/** Open the encoder for the audio stream to use it later. */
|
||||
if ((error = avcodec_open2(avctx, output_codec, NULL)) < 0) {
|
||||
if ((error = avcodec_open2(*output_codec_context, output_codec, NULL)) < 0) {
|
||||
fprintf(stderr, "Could not open output codec (error '%s')\n",
|
||||
get_error_text(error));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
error = avcodec_parameters_from_context(stream->codecpar, avctx);
|
||||
if (error < 0) {
|
||||
fprintf(stderr, "Could not initialize stream parameters\n");
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
/** Save the encoder context for easier access later. */
|
||||
*output_codec_context = avctx;
|
||||
|
||||
return 0;
|
||||
|
||||
cleanup:
|
||||
avcodec_free_context(&avctx);
|
||||
avio_closep(&(*output_format_context)->pb);
|
||||
avformat_free_context(*output_format_context);
|
||||
*output_format_context = NULL;
|
||||
@@ -788,13 +756,13 @@ cleanup:
|
||||
av_audio_fifo_free(fifo);
|
||||
swr_free(&resample_context);
|
||||
if (output_codec_context)
|
||||
avcodec_free_context(&output_codec_context);
|
||||
avcodec_close(output_codec_context);
|
||||
if (output_format_context) {
|
||||
avio_closep(&output_format_context->pb);
|
||||
avformat_free_context(output_format_context);
|
||||
}
|
||||
if (input_codec_context)
|
||||
avcodec_free_context(&input_codec_context);
|
||||
avcodec_close(input_codec_context);
|
||||
if (input_format_context)
|
||||
avformat_close_input(&input_format_context);
|
||||
|
||||
|
||||
@@ -128,10 +128,7 @@ static int open_output_file(const char *filename)
|
||||
enc_ctx->width = dec_ctx->width;
|
||||
enc_ctx->sample_aspect_ratio = dec_ctx->sample_aspect_ratio;
|
||||
/* take first format from list of supported formats */
|
||||
if (encoder->pix_fmts)
|
||||
enc_ctx->pix_fmt = encoder->pix_fmts[0];
|
||||
else
|
||||
enc_ctx->pix_fmt = dec_ctx->pix_fmt;
|
||||
enc_ctx->pix_fmt = encoder->pix_fmts[0];
|
||||
/* video time_base can be set to whatever is handy and supported by encoder */
|
||||
enc_ctx->time_base = dec_ctx->time_base;
|
||||
} else {
|
||||
|
||||
14
doc/faq.texi
14
doc/faq.texi
@@ -311,18 +311,18 @@ invoking ffmpeg with several @option{-i} options.
|
||||
For audio, to put all channels together in a single stream (example: two
|
||||
mono streams into one stereo stream): this is sometimes called to
|
||||
@emph{merge} them, and can be done using the
|
||||
@url{ffmpeg-filters.html#amerge, @code{amerge}} filter.
|
||||
@url{https://ffmpeg.org/ffmpeg-filters.html#amerge, @code{amerge}} filter.
|
||||
|
||||
@item
|
||||
For audio, to play one on top of the other: this is called to @emph{mix}
|
||||
them, and can be done by first merging them into a single stream and then
|
||||
using the @url{ffmpeg-filters.html#pan, @code{pan}} filter to mix
|
||||
using the @url{https://ffmpeg.org/ffmpeg-filters.html#pan, @code{pan}} filter to mix
|
||||
the channels at will.
|
||||
|
||||
@item
|
||||
For video, to display both together, side by side or one on top of a part of
|
||||
the other; it can be done using the
|
||||
@url{ffmpeg-filters.html#overlay, @code{overlay}} video filter.
|
||||
@url{https://ffmpeg.org/ffmpeg-filters.html#overlay, @code{overlay}} video filter.
|
||||
|
||||
@end itemize
|
||||
|
||||
@@ -333,19 +333,19 @@ There are several solutions, depending on the exact circumstances.
|
||||
|
||||
@subsection Concatenating using the concat @emph{filter}
|
||||
|
||||
FFmpeg has a @url{ffmpeg-filters.html#concat,
|
||||
FFmpeg has a @url{https://ffmpeg.org/ffmpeg-filters.html#concat,
|
||||
@code{concat}} filter designed specifically for that, with examples in the
|
||||
documentation. This operation is recommended if you need to re-encode.
|
||||
|
||||
@subsection Concatenating using the concat @emph{demuxer}
|
||||
|
||||
FFmpeg has a @url{ffmpeg-formats.html#concat,
|
||||
FFmpeg has a @url{https://www.ffmpeg.org/ffmpeg-formats.html#concat,
|
||||
@code{concat}} demuxer which you can use when you want to avoid a re-encode and
|
||||
your format doesn't support file level concatenation.
|
||||
|
||||
@subsection Concatenating using the concat @emph{protocol} (file level)
|
||||
|
||||
FFmpeg has a @url{ffmpeg-protocols.html#concat,
|
||||
FFmpeg has a @url{https://ffmpeg.org/ffmpeg-protocols.html#concat,
|
||||
@code{concat}} protocol designed specifically for that, with examples in the
|
||||
documentation.
|
||||
|
||||
@@ -485,7 +485,7 @@ scaling adjusts the SAR to keep the DAR constant.
|
||||
|
||||
If you want to stretch, or “unstretch”, the image, you need to override the
|
||||
information with the
|
||||
@url{ffmpeg-filters.html#setdar_002c-setsar, @code{setdar or setsar filters}}.
|
||||
@url{https://ffmpeg.org/ffmpeg-filters.html#setdar_002c-setsar, @code{setdar or setsar filters}}.
|
||||
|
||||
Do not forget to examine carefully the original video to check whether the
|
||||
stretching comes from the image or from the aspect ratio information.
|
||||
|
||||
@@ -223,7 +223,7 @@ with the highest resolution, for audio, it is the stream with the most channels,
|
||||
subtitles, it is the first subtitle stream. In the case where several streams of
|
||||
the same type rate equally, the stream with the lowest index is chosen.
|
||||
|
||||
You can disable some of those defaults by using the @code{-vn/-an/-sn/-dn} options. For
|
||||
You can disable some of those defaults by using the @code{-vn/-an/-sn} options. For
|
||||
full manual control, use the @code{-map} option, which disables the defaults just
|
||||
described.
|
||||
|
||||
@@ -720,7 +720,7 @@ For DXVA2, this option should contain the number of the display adapter to use.
|
||||
If this option is not specified, the default adapter is used.
|
||||
|
||||
@item qsv
|
||||
For QSV, this option corresponds to the values of MFX_IMPL_* . Allowed values
|
||||
For QSV, this option corresponds to the valus of MFX_IMPL_* . Allowed values
|
||||
are:
|
||||
@table @option
|
||||
@item auto
|
||||
@@ -1008,7 +1008,7 @@ Dump each input packet to stderr.
|
||||
@item -hex (@emph{global})
|
||||
When dumping packets, also dump the payload.
|
||||
@item -re (@emph{input})
|
||||
Read input at native frame rate. Mainly used to simulate a grab device,
|
||||
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).
|
||||
@@ -1279,15 +1279,6 @@ No packets were passed to the muxer, the output is empty.
|
||||
@item -xerror (@emph{global})
|
||||
Stop and exit on error
|
||||
|
||||
@item -max_muxing_queue_size @var{packets} (@emph{output,per-stream})
|
||||
When transcoding audio and/or video streams, ffmpeg will not begin writing into
|
||||
the output until it has one packet for each such stream. While waiting for that
|
||||
to happen, packets for other streams are buffered. This option sets the size of
|
||||
this buffer, in packets, for the matching output stream.
|
||||
|
||||
The default value of this option should be high enough for most uses, so only
|
||||
touch this option if you are sure that you need it.
|
||||
|
||||
@end table
|
||||
|
||||
As a special exception, you can use a bitmap subtitle stream as input: it
|
||||
|
||||
@@ -245,7 +245,7 @@ continue reading from that.
|
||||
Each interval is specified by two optional parts, separated by "%".
|
||||
|
||||
The first part specifies the interval start position. It is
|
||||
interpreted as an absolute position, or as a relative offset from the
|
||||
interpreted as an abolute position, or as a relative offset from the
|
||||
current position if it is preceded by the "+" character. If this first
|
||||
part is not specified, no seeking will be performed when reading this
|
||||
interval.
|
||||
|
||||
@@ -129,7 +129,6 @@
|
||||
<xsd:complexType name="frameSideDataType">
|
||||
<xsd:attribute name="side_data_type" type="xsd:string"/>
|
||||
<xsd:attribute name="side_data_size" type="xsd:int" />
|
||||
<xsd:attribute name="timecode" type="xsd:string"/>
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="subtitleType">
|
||||
@@ -166,7 +165,6 @@
|
||||
<xsd:attribute name="visual_impaired" type="xsd:int" use="required" />
|
||||
<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:complexType>
|
||||
|
||||
<xsd:complexType name="streamType">
|
||||
@@ -202,7 +200,6 @@
|
||||
<xsd:attribute name="color_transfer" type="xsd:string"/>
|
||||
<xsd:attribute name="color_primaries" type="xsd:string"/>
|
||||
<xsd:attribute name="chroma_location" type="xsd:string"/>
|
||||
<xsd:attribute name="field_order" type="xsd:string"/>
|
||||
<xsd:attribute name="timecode" type="xsd:string"/>
|
||||
<xsd:attribute name="refs" type="xsd:int"/>
|
||||
|
||||
|
||||
@@ -317,7 +317,7 @@ StartSendOnKey
|
||||
#AVPresetVideo baseline
|
||||
#AVOptionVideo flags +global_header
|
||||
#
|
||||
#AudioCodec aac
|
||||
#AudioCodec libfaac
|
||||
#AudioBitRate 32
|
||||
#AudioChannels 2
|
||||
#AudioSampleRate 22050
|
||||
|
||||
@@ -176,10 +176,10 @@ loglevel will be used. If multiple loglevel parameters are given, using
|
||||
Show nothing at all; be silent.
|
||||
@item panic, 0
|
||||
Only show fatal errors which could lead the process to crash, such as
|
||||
an assertion failure. This is not currently used for anything.
|
||||
and assert failure. This is not currently used for anything.
|
||||
@item fatal, 8
|
||||
Only show fatal errors. These are errors after which the process absolutely
|
||||
cannot continue.
|
||||
cannot continue after.
|
||||
@item error, 16
|
||||
Show all errors, including ones which can be recovered from.
|
||||
@item warning, 24
|
||||
@@ -195,13 +195,13 @@ Show everything, including debugging information.
|
||||
@item trace, 56
|
||||
@end table
|
||||
|
||||
By default the program logs to stderr. If coloring is supported by the
|
||||
By default the program logs to stderr, if coloring is supported by the
|
||||
terminal, colors are used to mark errors and warnings. Log coloring
|
||||
can be disabled setting the environment variable
|
||||
@env{AV_LOG_FORCE_NOCOLOR} or @env{NO_COLOR}, or can be forced setting
|
||||
the environment variable @env{AV_LOG_FORCE_COLOR}.
|
||||
The use of the environment variable @env{NO_COLOR} is deprecated and
|
||||
will be dropped in a future FFmpeg version.
|
||||
will be dropped in a following FFmpeg version.
|
||||
|
||||
@item -report
|
||||
Dump full command line and console output to a file named
|
||||
|
||||
2650
doc/filters.texi
2650
doc/filters.texi
File diff suppressed because it is too large
Load Diff
@@ -61,10 +61,6 @@ Reduce the latency introduced by optional buffering
|
||||
Only write platform-, build- and time-independent data.
|
||||
This ensures that file and data checksums are reproducible and match between
|
||||
platforms. Its primary use is for regression testing.
|
||||
@item shortest
|
||||
Stop muxing at the end of the shortest stream.
|
||||
It may be needed to increase max_interleave_delta to avoid flusing the longer
|
||||
streams before EOF.
|
||||
@end table
|
||||
|
||||
@item seek2any @var{integer} (@emph{input})
|
||||
@@ -151,7 +147,7 @@ a packet for each stream, regardless of the maximum timestamp
|
||||
difference between the buffered packets.
|
||||
|
||||
@item use_wallclock_as_timestamps @var{integer} (@emph{input})
|
||||
Use wallclock as timestamps if set to 1. Default is 0.
|
||||
Use wallclock as timestamps.
|
||||
|
||||
@item avoid_negative_ts @var{integer} (@emph{output})
|
||||
|
||||
@@ -199,7 +195,7 @@ delayed bt the time duration specified in @var{offset}. Default value
|
||||
is @code{0} (meaning that no offset is applied).
|
||||
|
||||
@item format_whitelist @var{list} (@emph{input})
|
||||
"," separated list of allowed demuxers. By default all are allowed.
|
||||
"," separated List of allowed demuxers. By default all are allowed.
|
||||
|
||||
@item dump_separator @var{string} (@emph{input})
|
||||
Separator used to separate the fields printed on the command line about the
|
||||
|
||||
@@ -103,19 +103,12 @@ enable it.
|
||||
|
||||
@section OpenH264
|
||||
|
||||
FFmpeg can make use of the OpenH264 library for H.264 encoding and decoding.
|
||||
FFmpeg can make use of the OpenH264 library for H.264 encoding.
|
||||
|
||||
Go to @url{http://www.openh264.org/} and follow the instructions for
|
||||
installing the library. Then pass @code{--enable-libopenh264} to configure to
|
||||
enable it.
|
||||
|
||||
For decoding, this library is much more limited than the built-in decoder
|
||||
in libavcodec; currently, this library lacks support for decoding B-frames
|
||||
and some other main/high profile features. (It currently only supports
|
||||
constrained baseline profile and CABAC.) Using it is mostly useful for
|
||||
testing and for taking advantage of Cisco's patent portfolio license
|
||||
(@url{http://www.openh264.org/BINARY_LICENSE.txt}).
|
||||
|
||||
@section x264
|
||||
|
||||
FFmpeg can make use of the x264 library for H.264 encoding.
|
||||
@@ -509,7 +502,7 @@ library:
|
||||
@tab Used on the Nintendo GameCube.
|
||||
@item Tiertex Limited SEQ @tab @tab X
|
||||
@tab Tiertex .seq files used in the DOS CD-ROM version of the game Flashback.
|
||||
@item True Audio @tab X @tab X
|
||||
@item True Audio @tab @tab X
|
||||
@item VAG @tab @tab X
|
||||
@tab Audio format used in many Sony PS2 games.
|
||||
@item VC-1 test bitstream @tab X @tab X
|
||||
@@ -527,7 +520,6 @@ library:
|
||||
@tab Multimedia format used in Westwood Studios games.
|
||||
@item Westwood Studios VQA @tab @tab X
|
||||
@tab Multimedia format used in Westwood Studios games.
|
||||
@item Wideband Single-bit Data (WSD) @tab @tab X
|
||||
@item WVE @tab @tab X
|
||||
@item XMV @tab @tab X
|
||||
@tab Microsoft video container used in Xbox games.
|
||||
@@ -651,7 +643,6 @@ following image formats are supported:
|
||||
@item Bethesda VID video @tab @tab X
|
||||
@tab Used in some games from Bethesda Softworks.
|
||||
@item Bink Video @tab @tab X
|
||||
@item BitJazz SheerVideo @tab @tab X
|
||||
@item Bitmap Brothers JV video @tab @tab X
|
||||
@item y41p Brooktree uncompressed 4:1:1 12-bit @tab X @tab X
|
||||
@item Brute Force & Ignorance @tab @tab X
|
||||
@@ -686,8 +677,6 @@ following image formats are supported:
|
||||
@tab fourcc: DUCK
|
||||
@item Duck TrueMotion 2.0 @tab @tab X
|
||||
@tab fourcc: TM20
|
||||
@item Duck TrueMotion 2.0 RT @tab @tab X
|
||||
@tab fourcc: TR20
|
||||
@item DV (Digital Video) @tab X @tab X
|
||||
@item Dxtory capture format @tab @tab X
|
||||
@item Feeble Files/ScummVM DXA @tab @tab X
|
||||
@@ -754,7 +743,6 @@ following image formats are supported:
|
||||
@item LucasArts SANM/Smush @tab @tab X
|
||||
@tab Used in LucasArts games / SMUSH animations.
|
||||
@item lossless MJPEG @tab X @tab X
|
||||
@item MagicYUV Video @tab @tab X
|
||||
@item Microsoft ATC Screen @tab @tab X
|
||||
@tab Also known as Microsoft Screen 3.
|
||||
@item Microsoft Expression Encoder Screen @tab @tab X
|
||||
@@ -887,7 +875,7 @@ following image formats are supported:
|
||||
@item 8SVX exponential @tab @tab X
|
||||
@item 8SVX fibonacci @tab @tab X
|
||||
@item AAC @tab EX @tab X
|
||||
@tab encoding supported through internal encoder and external library libfdk-aac
|
||||
@tab encoding supported through internal encoder and external libraries libfaac and libfdk-aac
|
||||
@item AAC+ @tab E @tab IX
|
||||
@tab encoding supported through external library libfdk-aac
|
||||
@item AC-3 @tab IX @tab IX
|
||||
@@ -962,7 +950,7 @@ following image formats are supported:
|
||||
@item COOK @tab @tab X
|
||||
@tab All versions except 5.1 are supported.
|
||||
@item DCA (DTS Coherent Acoustics) @tab X @tab X
|
||||
@tab supported extensions: XCh, XXCH, X96, XBR, XLL, LBR (partially)
|
||||
@tab supported extensions: XCh, XLL (partially)
|
||||
@item DPCM id RoQ @tab X @tab X
|
||||
@tab Used in Quake III, Jedi Knight 2 and other computer games.
|
||||
@item DPCM Interplay @tab @tab X
|
||||
@@ -979,7 +967,6 @@ following image formats are supported:
|
||||
@item DSD (Direct Stream Digitial), least significant bit first, planar @tab @tab X
|
||||
@item DSD (Direct Stream Digitial), most significant bit first, planar @tab @tab X
|
||||
@item DSP Group TrueSpeech @tab @tab X
|
||||
@item DST (Direct Stream Transfer) @tab @tab X
|
||||
@item DV audio @tab @tab X
|
||||
@item Enhanced AC-3 @tab X @tab X
|
||||
@item EVRC (Enhanced Variable Rate Codec) @tab @tab X
|
||||
@@ -997,7 +984,7 @@ following image formats are supported:
|
||||
@item Interplay ACM @tab @tab X
|
||||
@item MACE (Macintosh Audio Compression/Expansion) 3:1 @tab @tab X
|
||||
@item MACE (Macintosh Audio Compression/Expansion) 6:1 @tab @tab X
|
||||
@item MLP (Meridian Lossless Packing) @tab X @tab X
|
||||
@item MLP (Meridian Lossless Packing) @tab @tab X
|
||||
@tab Used in DVD-Audio discs.
|
||||
@item Monkey's Audio @tab @tab X
|
||||
@item MP1 (MPEG audio layer 1) @tab @tab IX
|
||||
@@ -1064,7 +1051,7 @@ following image formats are supported:
|
||||
@tab supported through external library libspeex
|
||||
@item TAK (Tom's lossless Audio Kompressor) @tab @tab X
|
||||
@item True Audio (TTA) @tab X @tab X
|
||||
@item TrueHD @tab X @tab X
|
||||
@item TrueHD @tab @tab X
|
||||
@tab Used in HD-DVD and Blu-Ray discs.
|
||||
@item TwinVQ (VQF flavor) @tab @tab X
|
||||
@item VIMA @tab @tab X
|
||||
|
||||
@@ -408,7 +408,7 @@ with @option{--dry-run} first. And then inspecting the commits listed with
|
||||
@command{git log -p 1234567..987654}. The @command{git status} command
|
||||
may help in finding local changes that have been forgotten to be added.
|
||||
|
||||
Next let the code pass through a full run of our test suite.
|
||||
Next let the code pass through a full run of our testsuite.
|
||||
|
||||
@itemize
|
||||
@item @command{make distclean}
|
||||
@@ -418,7 +418,7 @@ Next let the code pass through a full run of our test suite.
|
||||
@end itemize
|
||||
|
||||
Make sure all your changes have been checked before pushing them, the
|
||||
test suite only checks against regressions and that only to some extend. It does
|
||||
testsuite only checks against regressions and that only to some extend. It does
|
||||
obviously not check newly added features/code to be working unless you have
|
||||
added a test for that (which is recommended).
|
||||
|
||||
|
||||
@@ -251,32 +251,6 @@ To use this option, ffmpeg needs to be compiled with @code{--enable-libzvbi}.
|
||||
Defines number of audio channels to capture. Must be @samp{2}, @samp{8} or @samp{16}.
|
||||
Defaults to @samp{2}.
|
||||
|
||||
@item duplex_mode
|
||||
Sets the decklink device duplex mode. Must be @samp{unset}, @samp{half} or @samp{full}.
|
||||
Defaults to @samp{unset}.
|
||||
|
||||
@item video_input
|
||||
Sets the video input source. Must be @samp{unset}, @samp{sdi}, @samp{hdmi},
|
||||
@samp{optical_sdi}, @samp{component}, @samp{composite} or @samp{s_video}.
|
||||
Defaults to @samp{unset}.
|
||||
|
||||
@item audio_input
|
||||
Sets the audio input source. Must be @samp{unset}, @samp{embedded},
|
||||
@samp{aes_ebu}, @samp{analog}, @samp{analog_xlr}, @samp{analog_rca} or
|
||||
@samp{microphone}. Defaults to @samp{unset}.
|
||||
|
||||
@item video_pts
|
||||
Sets the video packet timestamp source. Must be @samp{video}, @samp{audio},
|
||||
@samp{reference} or @samp{wallclock}. Defaults to @samp{video}.
|
||||
|
||||
@item audio_pts
|
||||
Sets the audio packet timestamp source. Must be @samp{video}, @samp{audio},
|
||||
@samp{reference} or @samp{wallclock}. Defaults to @samp{audio}.
|
||||
|
||||
@item draw_bars
|
||||
If set to @samp{true}, color bars are drawn in the event of a signal loss.
|
||||
Defaults to @samp{true}.
|
||||
|
||||
@end table
|
||||
|
||||
@subsection Examples
|
||||
@@ -682,7 +656,7 @@ is an exact value. For HDV, it is not frame exact, since HDV does
|
||||
not have a fixed frame size.
|
||||
|
||||
@item dvguid
|
||||
Select the capture device by specifying its GUID. Capturing will only
|
||||
Select the capture device by specifying it's GUID. Capturing will only
|
||||
be performed from the specified device and fails if no device with the
|
||||
given GUID is found. This is useful to select the input if multiple
|
||||
devices are connected at the same time.
|
||||
@@ -1345,7 +1319,7 @@ ffmpeg -f x11grab -framerate 25 -video_size cif -i :0.0+10,20 out.mpg
|
||||
|
||||
@table @option
|
||||
@item draw_mouse
|
||||
Specify whether to draw the mouse pointer. A value of @code{0} specifies
|
||||
Specify whether to draw the mouse pointer. A value of @code{0} specify
|
||||
not to draw the pointer. Default value is @code{1}.
|
||||
|
||||
@item follow_mouse
|
||||
|
||||
@@ -1,98 +0,0 @@
|
||||
CONTEXT
|
||||
=======
|
||||
|
||||
The FFmpeg project merges all the changes from the Libav project
|
||||
(https://libav.org) since the origin of the fork (around 2011).
|
||||
|
||||
With the exceptions of some commits due to technical/political disagreements or
|
||||
issues, the changes are merged on a more or less regular schedule (daily for
|
||||
years thanks to Michael, but more sparse nowadays).
|
||||
|
||||
WHY
|
||||
===
|
||||
|
||||
The majority of the active developers believe the project needs to keep this
|
||||
policy for various reasons.
|
||||
|
||||
The most important one is that we don't want our users to have to choose
|
||||
between two distributors of libraries of the exact same name in order to have a
|
||||
different set of features and bugfixes. By taking the responsibility of
|
||||
unifying the two codebases, we allow users to benefit from the changes from the
|
||||
two teams.
|
||||
|
||||
Today, FFmpeg has a much larger user database (we are distributed by every
|
||||
major distribution), so we consider this mission a priority.
|
||||
|
||||
A different approach to the merge could have been to pick the changes we are
|
||||
interested in and drop most of the cosmetics and other less important changes.
|
||||
Unfortunately, this makes the following picks much harder, especially since the
|
||||
Libav project is involved in various deep API changes. As a result, we decide
|
||||
to virtually take everything done there.
|
||||
|
||||
Any Libav developer is of course welcome anytime to contribute directly to the
|
||||
FFmpeg tree. Of course, we fully understand and are forced to accept that very
|
||||
few Libav developers are interested in doing so, but we still want to recognize
|
||||
their work. This leads us to create merge commits for every single one from
|
||||
Libav. The original commit appears totally unchanged with full authorship in
|
||||
our history (and the conflict are solved in the merge one). That way, not a
|
||||
single thing from Libav will be lost in the future in case some reunification
|
||||
happens, or that project disappears one way or another.
|
||||
|
||||
DOWNSIDES
|
||||
=========
|
||||
|
||||
Of course, there are many downsides to this approach.
|
||||
|
||||
- It causes a non negligible merge commits pollution. We make sure there are
|
||||
not several level of merges entangled (we do a 1:1 merge/commit), but it's
|
||||
still a non-linear history.
|
||||
|
||||
- Many duplicated work. For instance, we added libavresample in our tree to
|
||||
keep compatibility with Libav when our libswresample was already covering the
|
||||
exact same purpose. The same thing happened for various elements such as the
|
||||
ProRes support (but differences in features, bugs, licenses, ...). There are
|
||||
many work to do to unify them, and any help is very much welcome.
|
||||
|
||||
- So much manpower from both FFmpeg and Libav is lost because of this mess. We
|
||||
know it, and we don't know how to fix it. It takes incredible time to do
|
||||
these merges, so we have even less time to work on things we personally care
|
||||
about. The bad vibes also do not help with keeping our developers motivated.
|
||||
|
||||
- There is a growing technical risk factor with the merges due to the codebase
|
||||
differing more and more.
|
||||
|
||||
MERGE GUIDELINES
|
||||
================
|
||||
|
||||
The following gives developer guidelines on how to proceed when merging Libav commits.
|
||||
|
||||
Before starting, you can reduce the risk of errors on merge conflicts by using
|
||||
a different merge conflict style:
|
||||
|
||||
$ git config --global merge.conflictstyle diff3
|
||||
|
||||
tools/libav-merge-next-commit is a script to help merging the next commit in
|
||||
the queue. It assumes a remote named libav. It has two modes: merge, and noop.
|
||||
The noop mode creates a merge with no change to the HEAD. You can pass a hash
|
||||
as extra argument to reference a justification (it is common that we already
|
||||
have the change done in FFmpeg).
|
||||
|
||||
Also see tools/murge, you can copy and paste a 3 way conflict into its stdin
|
||||
and it will display colored diffs. Any arguments to murge (like ones to suppress
|
||||
whitespace differences) are passed into colordiff.
|
||||
|
||||
TODO/FIXME/UNMERGED
|
||||
===================
|
||||
|
||||
Stuff that didn't reach the codebase:
|
||||
-------------------------------------
|
||||
|
||||
- HEVC DSP and x86 MC SIMD improvements from Libav (see https://ffmpeg.org/pipermail/ffmpeg-devel/2015-December/184777.html)
|
||||
- QSV HWContext integration (04b17ff and 130e1f1), QSV scaling filter (62c58c5)
|
||||
|
||||
Collateral damage that needs work locally:
|
||||
------------------------------------------
|
||||
|
||||
- Merge proresdec2.c and proresdec_lgpl.c
|
||||
- Merge proresenc_anatoliy.c and proresenc_kostya.c
|
||||
- Remove ADVANCED_PARSER in libavcodec/hevc_parser.c
|
||||
395
doc/muxers.texi
395
doc/muxers.texi
@@ -129,27 +129,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.
|
||||
@end table
|
||||
@end table
|
||||
|
||||
@anchor{framecrc}
|
||||
@section framecrc
|
||||
|
||||
@@ -195,70 +174,30 @@ ffmpeg -i INPUT -c:a pcm_u8 -c:v mpeg2video -f framecrc -
|
||||
|
||||
See also the @ref{crc} muxer.
|
||||
|
||||
@anchor{framehash}
|
||||
@section framehash
|
||||
|
||||
Per-packet hash testing format.
|
||||
|
||||
This muxer computes and prints a cryptographic hash for each audio
|
||||
and video packet. This can be used for packet-by-packet equality
|
||||
checks without having to individually do a binary comparison on each.
|
||||
|
||||
By default audio frames are converted to signed 16-bit raw audio and
|
||||
video frames to raw video before computing the hash, but the output
|
||||
of explicit conversions to other codecs can also be used. It uses the
|
||||
SHA-256 cryptographic hash function by default, but supports several
|
||||
other algorithms.
|
||||
|
||||
The output of the muxer consists of a line for each audio and video
|
||||
packet of the form:
|
||||
@example
|
||||
@var{stream_index}, @var{packet_dts}, @var{packet_pts}, @var{packet_duration}, @var{packet_size}, @var{hash}
|
||||
@end example
|
||||
|
||||
@var{hash} is a hexadecimal number representing the computed hash
|
||||
for the packet.
|
||||
|
||||
@table @option
|
||||
@item hash @var{algorithm}
|
||||
Use the cryptographic hash function specified by the string @var{algorithm}.
|
||||
Supported values include @code{MD5}, @code{murmur3}, @code{RIPEMD128},
|
||||
@code{RIPEMD160}, @code{RIPEMD256}, @code{RIPEMD320}, @code{SHA160},
|
||||
@code{SHA224}, @code{SHA256} (default), @code{SHA512/224}, @code{SHA512/256},
|
||||
@code{SHA384}, @code{SHA512}, @code{CRC32} and @code{adler32}.
|
||||
|
||||
@end table
|
||||
|
||||
@subsection Examples
|
||||
|
||||
To compute the SHA-256 hash of the audio and video frames in @file{INPUT},
|
||||
converted to raw audio and video packets, and store it in the file
|
||||
@file{out.sha256}:
|
||||
@example
|
||||
ffmpeg -i INPUT -f framehash out.sha256
|
||||
@end example
|
||||
|
||||
To print the information to stdout, using the MD5 hash function, use
|
||||
the command:
|
||||
@example
|
||||
ffmpeg -i INPUT -f framehash -hash md5 -
|
||||
@end example
|
||||
|
||||
See also the @ref{hash} muxer.
|
||||
|
||||
@anchor{framemd5}
|
||||
@section framemd5
|
||||
|
||||
Per-packet MD5 testing format.
|
||||
|
||||
This is a variant of the @ref{framehash} muxer. Unlike that muxer,
|
||||
it defaults to using the MD5 hash function.
|
||||
This muxer computes and prints the MD5 hash for each audio
|
||||
and video packet. By default audio frames are converted to signed
|
||||
16-bit raw audio and video frames to raw video before computing the
|
||||
hash.
|
||||
|
||||
The output of the muxer consists of a line for each audio and video
|
||||
packet of the form:
|
||||
@example
|
||||
@var{stream_index}, @var{packet_dts}, @var{packet_pts}, @var{packet_duration}, @var{packet_size}, @var{MD5}
|
||||
@end example
|
||||
|
||||
@var{MD5} is a hexadecimal number representing the computed MD5 hash
|
||||
for the packet.
|
||||
|
||||
@subsection Examples
|
||||
|
||||
To compute the MD5 hash of the audio and video frames in @file{INPUT},
|
||||
converted to raw audio and video packets, and store it in the file
|
||||
@file{out.md5}:
|
||||
For example to compute the MD5 of the audio and video frames in
|
||||
@file{INPUT}, converted to raw audio and video packets, and store it
|
||||
in the file @file{out.md5}:
|
||||
@example
|
||||
ffmpeg -i INPUT -f framemd5 out.md5
|
||||
@end example
|
||||
@@ -268,7 +207,7 @@ To print the information to stdout, use the command:
|
||||
ffmpeg -i INPUT -f framemd5 -
|
||||
@end example
|
||||
|
||||
See also the @ref{framehash} and @ref{md5} muxers.
|
||||
See also the @ref{md5} muxer.
|
||||
|
||||
@anchor{gif}
|
||||
@section gif
|
||||
@@ -295,59 +234,14 @@ the loops:
|
||||
ffmpeg -i INPUT -loop 10 -final_delay 500 out.gif
|
||||
@end example
|
||||
|
||||
Note 1: if you wish to extract the frames into separate GIF files, you need to
|
||||
Note 1: if you wish to extract the frames in separate GIF files, you need to
|
||||
force the @ref{image2} muxer:
|
||||
@example
|
||||
ffmpeg -i INPUT -c:v gif -f image2 "out%d.gif"
|
||||
@end example
|
||||
|
||||
Note 2: the GIF format has a very large time base: the delay between two frames
|
||||
can therefore not be smaller than one centi second.
|
||||
|
||||
@anchor{hash}
|
||||
@section hash
|
||||
|
||||
Hash testing format.
|
||||
|
||||
This muxer computes and prints a cryptographic hash of all the input
|
||||
audio and video frames. This can be used for equality checks without
|
||||
having to do a complete binary comparison.
|
||||
|
||||
By default audio frames are converted to signed 16-bit raw audio and
|
||||
video frames to raw video before computing the hash, but the output
|
||||
of explicit conversions to other codecs can also be used. Timestamps
|
||||
are ignored. It uses the SHA-256 cryptographic hash function by default,
|
||||
but supports several other algorithms.
|
||||
|
||||
The output of the muxer consists of a single line of the form:
|
||||
@var{algo}=@var{hash}, where @var{algo} is a short string representing
|
||||
the hash function used, and @var{hash} is a hexadecimal number
|
||||
representing the computed hash.
|
||||
|
||||
@table @option
|
||||
@item hash @var{algorithm}
|
||||
Use the cryptographic hash function specified by the string @var{algorithm}.
|
||||
Supported values include @code{MD5}, @code{murmur3}, @code{RIPEMD128},
|
||||
@code{RIPEMD160}, @code{RIPEMD256}, @code{RIPEMD320}, @code{SHA160},
|
||||
@code{SHA224}, @code{SHA256} (default), @code{SHA512/224}, @code{SHA512/256},
|
||||
@code{SHA384}, @code{SHA512}, @code{CRC32} and @code{adler32}.
|
||||
|
||||
@end table
|
||||
|
||||
@subsection Examples
|
||||
|
||||
To compute the SHA-256 hash of the input converted to raw audio and
|
||||
video, and store it in the file @file{out.sha256}:
|
||||
@example
|
||||
ffmpeg -i INPUT -f hash out.sha256
|
||||
@end example
|
||||
|
||||
To print an MD5 hash to stdout use the command:
|
||||
@example
|
||||
ffmpeg -i INPUT -f hash -hash md5 -
|
||||
@end example
|
||||
|
||||
See also the @ref{framehash} muxer.
|
||||
Note 2: the GIF format has a very small time base: the delay between two frames
|
||||
can not be smaller than one centi second.
|
||||
|
||||
@anchor{hls}
|
||||
@section hls
|
||||
@@ -378,15 +272,8 @@ segmentation.
|
||||
This muxer supports the following options:
|
||||
|
||||
@table @option
|
||||
@item hls_init_time @var{seconds}
|
||||
Set the initial target segment length in seconds. Default value is @var{0}.
|
||||
Segment will be cut on the next key frame after this time has passed on the first m3u8 list.
|
||||
After the initial playlist is filled @command{ffmpeg} will cut segments
|
||||
at duration equal to @code{hls_time}
|
||||
|
||||
@item hls_time @var{seconds}
|
||||
Set the target segment length in seconds. Default value is 2.
|
||||
Segment will be cut on the next key frame after this time has passed.
|
||||
Set the segment length in seconds. Default value is 2.
|
||||
|
||||
@item hls_list_size @var{size}
|
||||
Set the maximum number of playlist entries. If set to 0 the list file
|
||||
@@ -423,34 +310,14 @@ which can be cyclic, for example if the @option{wrap} option is
|
||||
specified.
|
||||
|
||||
@item hls_segment_filename @var{filename}
|
||||
Set the segment filename. Unless @code{hls_flags single_file} is set,
|
||||
@var{filename} is used as a string format with the segment number:
|
||||
Set the segment filename. Unless hls_flags single_file is set @var{filename}
|
||||
is used as a string format with the segment number:
|
||||
@example
|
||||
ffmpeg -i in.nut -hls_segment_filename 'file%03d.ts' out.m3u8
|
||||
ffmpeg in.nut -hls_segment_filename 'file%03d.ts' out.m3u8
|
||||
@end example
|
||||
This example will produce the playlist, @file{out.m3u8}, and segment files:
|
||||
@file{file000.ts}, @file{file001.ts}, @file{file002.ts}, etc.
|
||||
|
||||
@item use_localtime
|
||||
Use strftime on @var{filename} to expand the segment filename with localtime.
|
||||
The segment number (%d) is not available in this mode.
|
||||
@example
|
||||
ffmpeg -i in.nut -use_localtime 1 -hls_segment_filename 'file-%Y%m%d-%s.ts' out.m3u8
|
||||
@end example
|
||||
This example will produce the playlist, @file{out.m3u8}, and segment files:
|
||||
@file{file-20160215-1455569023.ts}, @file{file-20160215-1455569024.ts}, etc.
|
||||
|
||||
@item use_localtime_mkdir
|
||||
Used together with -use_localtime, it will create up to one subdirectory which
|
||||
is expanded in @var{filename}.
|
||||
@example
|
||||
ffmpeg -i in.nut -use_localtime 1 -use_localtime_mkdir 1 -hls_segment_filename '%Y%m%d/file-%Y%m%d-%s.ts' out.m3u8
|
||||
@end example
|
||||
This example will create a directory 201560215 (if it does not exist), and then
|
||||
produce the playlist, @file{out.m3u8}, and segment files:
|
||||
@file{201560215/file-20160215-1455569023.ts}, @file{201560215/file-20160215-1455569024.ts}, etc.
|
||||
|
||||
|
||||
@item hls_key_info_file @var{key_info_file}
|
||||
Use the information in @var{key_info_file} for segment encryption. The first
|
||||
line of @var{key_info_file} specifies the key URI written to the playlist. The
|
||||
@@ -521,49 +388,6 @@ Will produce the playlist, @file{out.m3u8}, and a single segment file,
|
||||
@item hls_flags delete_segments
|
||||
Segment files removed from the playlist are deleted after a period of time
|
||||
equal to the duration of the segment plus the duration of the playlist.
|
||||
|
||||
@item hls_flags append_list
|
||||
Append new segments into the end of old segment list,
|
||||
and remove the @code{#EXT-X-ENDLIST} from the old segment list.
|
||||
|
||||
@item hls_flags round_durations
|
||||
Round the duration info in the playlist file segment info to integer
|
||||
values, instead of using floating point.
|
||||
|
||||
@item hls_flags discont_starts
|
||||
Add the @code{#EXT-X-DISCONTINUITY} tag to the playlist, before the
|
||||
first segment's information.
|
||||
|
||||
@item hls_flags omit_endlist
|
||||
Do not append the @code{EXT-X-ENDLIST} tag at the end of the playlist.
|
||||
|
||||
@item hls_flags split_by_time
|
||||
Allow segments to start on frames other than keyframes. This improves
|
||||
behavior on some players when the time between keyframes is inconsistent,
|
||||
but may make things worse on others, and can cause some oddities during
|
||||
seeking. This flag should be used with the @code{hls_time} option.
|
||||
|
||||
@item hls_flags program_date_time
|
||||
Generate @code{EXT-X-PROGRAM-DATE-TIME} tags.
|
||||
|
||||
@item hls_playlist_type event
|
||||
Emit @code{#EXT-X-PLAYLIST-TYPE:EVENT} in the m3u8 header. Forces
|
||||
@option{hls_list_size} to 0; the playlist can only be appended to.
|
||||
|
||||
@item hls_playlist_type vod
|
||||
Emit @code{#EXT-X-PLAYLIST-TYPE:VOD} in the m3u8 header. Forces
|
||||
@option{hls_list_size} to 0; the playlist must not change.
|
||||
|
||||
@item method
|
||||
Use the given HTTP method to create the hls files.
|
||||
@example
|
||||
ffmpeg -re -i in.ts -f hls -method PUT http://example.com/live/out.m3u8
|
||||
@end example
|
||||
This example will upload all the mpegts segment files to the HTTP
|
||||
server using the HTTP PUT method, and update the m3u8 files every
|
||||
@code{refresh} times using the same method.
|
||||
Note that the HTTP server must support the given method for uploading
|
||||
files.
|
||||
@end table
|
||||
|
||||
@anchor{ico}
|
||||
@@ -777,12 +601,16 @@ have no effect if it is not.
|
||||
|
||||
MD5 testing format.
|
||||
|
||||
This is a variant of the @ref{hash} muxer. Unlike that muxer, it
|
||||
defaults to using the MD5 hash function.
|
||||
This muxer computes and prints the MD5 hash of all the input audio
|
||||
and video frames. By default audio frames are converted to signed
|
||||
16-bit raw audio and video frames to raw video before computing the
|
||||
hash. Timestamps are ignored.
|
||||
|
||||
@subsection Examples
|
||||
The output of the muxer consists of a single line of the form:
|
||||
MD5=@var{MD5}, where @var{MD5} is a hexadecimal number representing
|
||||
the computed MD5 hash.
|
||||
|
||||
To compute the MD5 hash of the input converted to raw
|
||||
For example to compute the MD5 hash of the input converted to raw
|
||||
audio and video, and store it in the file @file{out.md5}:
|
||||
@example
|
||||
ffmpeg -i INPUT -f md5 out.md5
|
||||
@@ -793,7 +621,7 @@ You can print the MD5 to stdout with the command:
|
||||
ffmpeg -i INPUT -f md5 -
|
||||
@end example
|
||||
|
||||
See also the @ref{hash} and @ref{framemd5} muxers.
|
||||
See also the @ref{framemd5} muxer.
|
||||
|
||||
@section mov, mp4, ismv
|
||||
|
||||
@@ -884,9 +712,6 @@ the new default-base-is-moof flag instead. This flag is new from
|
||||
14496-12:2012. This may make the fragments easier to parse in certain
|
||||
circumstances (avoiding basing track fragment location calculations
|
||||
on the implicit end of the previous track fragment).
|
||||
@item -write_tmcd
|
||||
Specify @code{on} to force writing a timecode track, @code{off} to disable it
|
||||
and @code{auto} to write a timecode track only for mov and mp4 output (default).
|
||||
@end table
|
||||
|
||||
@subsection Example
|
||||
@@ -973,41 +798,41 @@ and @code{service_name}. If they are not set the default for
|
||||
The muxer options are:
|
||||
|
||||
@table @option
|
||||
@item mpegts_original_network_id @var{number}
|
||||
@item -mpegts_original_network_id @var{number}
|
||||
Set the original_network_id (default 0x0001). This is unique identifier
|
||||
of a network in DVB. Its main use is in the unique identification of a
|
||||
service through the path Original_Network_ID, Transport_Stream_ID.
|
||||
@item mpegts_transport_stream_id @var{number}
|
||||
@item -mpegts_transport_stream_id @var{number}
|
||||
Set the transport_stream_id (default 0x0001). This identifies a
|
||||
transponder in DVB.
|
||||
@item mpegts_service_id @var{number}
|
||||
@item -mpegts_service_id @var{number}
|
||||
Set the service_id (default 0x0001) also known as program in DVB.
|
||||
@item mpegts_service_type @var{number}
|
||||
@item -mpegts_service_type @var{number}
|
||||
Set the program service_type (default @var{digital_tv}), see below
|
||||
a list of pre defined values.
|
||||
@item mpegts_pmt_start_pid @var{number}
|
||||
@item -mpegts_pmt_start_pid @var{number}
|
||||
Set the first PID for PMT (default 0x1000, max 0x1f00).
|
||||
@item mpegts_start_pid @var{number}
|
||||
@item -mpegts_start_pid @var{number}
|
||||
Set the first PID for data packets (default 0x0100, max 0x0f00).
|
||||
@item mpegts_m2ts_mode @var{number}
|
||||
@item -mpegts_m2ts_mode @var{number}
|
||||
Enable m2ts mode if set to 1. Default value is -1 which disables m2ts mode.
|
||||
@item muxrate @var{number}
|
||||
@item -muxrate @var{number}
|
||||
Set a constant muxrate (default VBR).
|
||||
@item pcr_period @var{numer}
|
||||
@item -pcr_period @var{numer}
|
||||
Override the default PCR retransmission time (default 20ms), ignored
|
||||
if variable muxrate is selected.
|
||||
@item pat_period @var{number}
|
||||
Maximal time in seconds between PAT/PMT tables.
|
||||
@item sdt_period @var{number}
|
||||
Maximal time in seconds between SDT tables.
|
||||
@item pes_payload_size @var{number}
|
||||
@item -pes_payload_size @var{number}
|
||||
Set minimum PES packet payload in bytes.
|
||||
@item mpegts_flags @var{flags}
|
||||
@item -mpegts_flags @var{flags}
|
||||
Set flags (see below).
|
||||
@item mpegts_copyts @var{number}
|
||||
@item -mpegts_copyts @var{number}
|
||||
Preserve original timestamps, if value is set to 1. Default value is -1, which
|
||||
results in shifting timestamps so that they start from 0.
|
||||
@item tables_version @var{number}
|
||||
@item -tables_version @var{number}
|
||||
Set PAT, PMT and SDT version (default 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 AVFormatContext (in case of API
|
||||
@@ -1023,7 +848,7 @@ ffmpeg -i source2.ts -codec copy -f mpegts -tables_version 1 udp://1.1.1.1:1111
|
||||
@end example
|
||||
@end table
|
||||
|
||||
Option @option{mpegts_service_type} accepts the following values:
|
||||
Option mpegts_service_type accepts the following values:
|
||||
|
||||
@table @option
|
||||
@item hex_value
|
||||
@@ -1044,7 +869,7 @@ Advanced Codec Digital SDTV service.
|
||||
Advanced Codec Digital HDTV service.
|
||||
@end table
|
||||
|
||||
Option @option{mpegts_flags} may take a set of such flags:
|
||||
Option mpegts_flags may take a set of such flags:
|
||||
|
||||
@table @option
|
||||
@item resend_headers
|
||||
@@ -1192,12 +1017,6 @@ implementation for HLS segmentation.
|
||||
The segment muxer supports the following options:
|
||||
|
||||
@table @option
|
||||
@item increment_tc @var{1|0}
|
||||
if set to @code{1}, increment timecode between each segment
|
||||
If this is selected, the input need to have
|
||||
a timecode in the first video stream. Default value is
|
||||
@code{0}.
|
||||
|
||||
@item reference_stream @var{specifier}
|
||||
Set the reference stream, as specified by the string @var{specifier}.
|
||||
If @var{specifier} is set to @code{auto}, the reference is chosen
|
||||
@@ -1385,11 +1204,6 @@ muxers/codecs. It is set to @code{0} by default.
|
||||
@item initial_offset @var{offset}
|
||||
Specify timestamp offset to apply to the output packet timestamps. The
|
||||
argument must be a time duration specification, and defaults to 0.
|
||||
|
||||
@item write_empty_segments @var{1|0}
|
||||
If enabled, write an empty segment if there are no packets during the period a
|
||||
segment would usually span. Otherwise, the segment will be filled with the next
|
||||
packet written. Defaults to @code{0}.
|
||||
@end table
|
||||
|
||||
@subsection Examples
|
||||
@@ -1437,9 +1251,9 @@ ffmpeg -i in.mkv -codec copy -map 0 -f segment -segment_list out.csv -segment_fr
|
||||
|
||||
@item
|
||||
Convert the @file{in.mkv} to TS segments using the @code{libx264}
|
||||
and @code{aac} encoders:
|
||||
and @code{libfaac} encoders:
|
||||
@example
|
||||
ffmpeg -i in.mkv -map 0 -codec:v libx264 -codec:a aac -f ssegment -segment_list out.list out%03d.ts
|
||||
ffmpeg -i in.mkv -map 0 -codec:v libx264 -codec:a libfaac -f ssegment -segment_list out.list out%03d.ts
|
||||
@end example
|
||||
|
||||
@item
|
||||
@@ -1473,101 +1287,6 @@ Specify whether to remove all fragments when finished. Default 0 (do not remove)
|
||||
|
||||
@end table
|
||||
|
||||
@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.
|
||||
|
||||
@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
|
||||
|
||||
The tee muxer can be used to write the same data to several files or any
|
||||
@@ -1614,12 +1333,6 @@ Select the streams that should be mapped to the slave output,
|
||||
specified by a stream specifier. If not specified, this defaults to
|
||||
all the input streams. You may use multiple stream specifiers
|
||||
separated by commas (@code{,}) e.g.: @code{a:0,v}
|
||||
|
||||
@item onfail
|
||||
Specify behaviour on output failure. This can be set to either @code{abort} (which is
|
||||
default) or @code{ignore}. @code{abort} will cause whole process to fail in case of failure
|
||||
on this slave output. @code{ignore} will ignore failure on this output, so other outputs
|
||||
will continue without being affected.
|
||||
@end table
|
||||
|
||||
@subsection Examples
|
||||
@@ -1633,14 +1346,6 @@ ffmpeg -i ... -c:v libx264 -c:a mp2 -f tee -map 0:v -map 0:a
|
||||
"archive-20121107.mkv|[f=mpegts]udp://10.0.1.255:1234/"
|
||||
@end example
|
||||
|
||||
@item
|
||||
As above, but continue streaming even if output to local file fails
|
||||
(for example local drive fills up):
|
||||
@example
|
||||
ffmpeg -i ... -c:v libx264 -c:a mp2 -f tee -map 0:v -map 0:a
|
||||
"[onfail=ignore]archive-20121107.mkv|[f=mpegts]udp://10.0.1.255:1234/"
|
||||
@end example
|
||||
|
||||
@item
|
||||
Use @command{ffmpeg} to encode the input, and send the output
|
||||
to three different destinations. The @code{dump_extra} bitstream
|
||||
|
||||
@@ -34,7 +34,7 @@ NUT has some variants signaled by using the flags field in its main header.
|
||||
|
||||
The BROADCAST variant provides a secondary time reference to facilitate
|
||||
detecting endpoint latency and network delays.
|
||||
It assumes all the endpoint clocks are synchronized.
|
||||
It assumes all the endpoint clocks are syncronized.
|
||||
To be used in real-time scenarios.
|
||||
|
||||
@section PIPE
|
||||
|
||||
@@ -7,7 +7,7 @@ If you plan to do non-x86 architecture specific optimizations (SIMD normally),
|
||||
then take a look in the x86/ directory, as most important functions are
|
||||
already optimized for MMX.
|
||||
|
||||
If you want to do x86 optimizations then you can either try to fine-tune the
|
||||
If you want to do x86 optimizations then you can either try to finetune the
|
||||
stuff in the x86 directory or find some other functions in the C source to
|
||||
optimize, but there aren't many left.
|
||||
|
||||
@@ -163,7 +163,7 @@ general x86 registers (e.g. eax) as well as XMM registers. This last one is
|
||||
particularly important on Win64, where xmm6-15 are callee-save, and not
|
||||
restoring their contents leads to undefined results. In external asm (e.g.
|
||||
yasm), you do this by using:
|
||||
cglobal function_name, num_args, num_regs, num_xmm_regs
|
||||
cglobal functon_name, num_args, num_regs, num_xmm_regs
|
||||
In inline asm, you specify clobbered registers at the end of your asm:
|
||||
__asm__(".." ::: "%eax").
|
||||
If gcc is not set to support sse (-msse) it will not accept xmm registers
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
Patchwork states
|
||||
|
||||
NEW: Initial state of new patches
|
||||
Accepted: The patch was pushed to the main master repository
|
||||
Rejected: The patch has been rejected
|
||||
Withdrawn: The patch was withdrawn by the author
|
||||
Not Applicable: The patch does not apply to the main master repository
|
||||
Superseded: A newer version of the patch has been posted
|
||||
Changes Requested: The patch has been or is under review and changes have been requested
|
||||
RFC: The patch is not intended to be applied but only for comments
|
||||
@@ -63,7 +63,7 @@ bash ./configure
|
||||
@section Darwin (Mac OS X, iPhone)
|
||||
|
||||
The toolchain provided with Xcode is sufficient to build the basic
|
||||
unaccelerated code.
|
||||
unacelerated code.
|
||||
|
||||
Mac OS X on PowerPC or ARM (iPhone) requires a preprocessor from
|
||||
@url{https://github.com/FFmpeg/gas-preprocessor} or
|
||||
@@ -144,7 +144,7 @@ pacman -S make pkgconf diffutils
|
||||
pacman -S mingw-w64-x86_64-yasm mingw-w64-x86_64-gcc mingw-w64-x86_64-SDL
|
||||
@end example
|
||||
|
||||
To target 32 bits replace @code{x86_64} with @code{i686} in the command above.
|
||||
To target 32bit replace the @code{x86_64} with @code{i686} in the command above.
|
||||
|
||||
@section Microsoft Visual C++ or Intel C++ Compiler for Windows
|
||||
|
||||
@@ -173,7 +173,7 @@ earlier, place @code{c99wrap.exe} and @code{c99conv.exe} somewhere in your
|
||||
Next, make sure any other headers and libs you want to use, such as zlib, are
|
||||
located in a spot that the compiler can see. Do so by modifying the @code{LIB}
|
||||
and @code{INCLUDE} environment variables to include the @strong{Windows-style}
|
||||
paths to these directories. Alternatively, you can try to use the
|
||||
paths to these directories. Alternatively, you can try and use the
|
||||
@code{--extra-cflags}/@code{--extra-ldflags} configure options. If using MSVC
|
||||
2012 or earlier, place @code{inttypes.h} somewhere the compiler can see too.
|
||||
|
||||
@@ -314,7 +314,7 @@ These library packages are only available from
|
||||
@uref{http://sourceware.org/cygwinports/, Cygwin Ports}:
|
||||
|
||||
@example
|
||||
yasm, libSDL-devel, libgsm-devel, libmp3lame-devel,
|
||||
yasm, libSDL-devel, libfaac-devel, libgsm-devel, libmp3lame-devel,
|
||||
libschroedinger1.0-devel, speex-devel, libtheora-devel, libxvidcore-devel
|
||||
@end example
|
||||
|
||||
|
||||
@@ -36,14 +36,6 @@ particular protocol using the option
|
||||
The option "-protocols" of the ff* tools will display the list of
|
||||
supported protocols.
|
||||
|
||||
All protocols accept the following options:
|
||||
|
||||
@table @option
|
||||
@item rw_timeout
|
||||
Maximum time to wait for (network) read/write operations to complete,
|
||||
in microseconds.
|
||||
@end table
|
||||
|
||||
A description of the currently available protocols follows.
|
||||
|
||||
@section async
|
||||
@@ -224,17 +216,6 @@ it, unless special care is taken (tests, customized server configuration
|
||||
etc.). Different FTP servers behave in different way during seek
|
||||
operation. ff* tools may produce incomplete content due to server limitations.
|
||||
|
||||
This protocol accepts the following options:
|
||||
|
||||
@table @option
|
||||
@item follow
|
||||
If set to 1, the protocol will retry reading at the end of the file, allowing
|
||||
reading files that still are being written. In order for this to terminate,
|
||||
you either need to use the rw_timeout option, or use the interrupt callback
|
||||
(for API users).
|
||||
|
||||
@end table
|
||||
|
||||
@section gopher
|
||||
|
||||
Gopher protocol.
|
||||
@@ -276,7 +257,7 @@ value is -1.
|
||||
If set to 1 use chunked Transfer-Encoding for posts, default is 1.
|
||||
|
||||
@item content_type
|
||||
Set a specific content type for the POST messages or for listen mode.
|
||||
Set a specific content type for the POST messages.
|
||||
|
||||
@item http_proxy
|
||||
set HTTP proxy to tunnel through e.g. http://example.com:1234
|
||||
@@ -291,13 +272,11 @@ Use persistent connections if set to 1, default is 0.
|
||||
@item post_data
|
||||
Set custom HTTP post data.
|
||||
|
||||
@item user-agent
|
||||
@item user_agent
|
||||
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 timeout
|
||||
Set timeout in microseconds of socket I/O operations used by the underlying low level
|
||||
operation. By default it is set to -1, which means that the timeout is
|
||||
@@ -357,7 +336,7 @@ autodetection in the future.
|
||||
If set to 1 enables experimental HTTP server. This can be used to send data when
|
||||
used as an output option, or read data from a client with HTTP POST when used as
|
||||
an input option.
|
||||
If set to 2 enables experimental multi-client HTTP server. This is not yet implemented
|
||||
If set to 2 enables experimental mutli-client HTTP server. This is not yet implemented
|
||||
in ffmpeg.c or ffserver.c and thus must not be used as a command line option.
|
||||
@example
|
||||
# Server side (sending):
|
||||
@@ -697,7 +676,7 @@ This protocol accepts the following options.
|
||||
|
||||
@table @option
|
||||
@item timeout
|
||||
Set timeout in milliseconds of socket I/O operations used by the underlying
|
||||
Set timeout in miliseconds of socket I/O operations used by the underlying
|
||||
low level operation. By default it is set to -1, which means that the timeout
|
||||
is not specified.
|
||||
|
||||
@@ -1161,15 +1140,6 @@ Play an AVI file directly from a TAR archive:
|
||||
subfile,,start,183241728,end,366490624,,:archive.tar
|
||||
@end example
|
||||
|
||||
@section tee
|
||||
|
||||
Writes the output to multiple protocols. The individual outputs are separated
|
||||
by |
|
||||
|
||||
@example
|
||||
tee:file://path/to/local/this.avi|file://path/to/local/that.avi
|
||||
@end example
|
||||
|
||||
@section tcp
|
||||
|
||||
Transmission Control Protocol.
|
||||
@@ -1296,14 +1266,6 @@ Set the UDP maximum socket buffer size in bytes. This is used to set either
|
||||
the receive or send buffer size, depending on what the socket is used for.
|
||||
Default is 64KB. See also @var{fifo_size}.
|
||||
|
||||
@item bitrate=@var{bitrate}
|
||||
If set to nonzero, the output will have the specified constant bitrate if the
|
||||
input has enough packets to sustain it.
|
||||
|
||||
@item burst_bits=@var{bits}
|
||||
When using @var{bitrate} this specifies the maximum number of bits in
|
||||
packet bursts.
|
||||
|
||||
@item localport=@var{port}
|
||||
Override the local UDP port to bind with.
|
||||
|
||||
|
||||
@@ -120,8 +120,8 @@ select the native SW Resampler; filter options precision and cheby are not
|
||||
applicable in this case.
|
||||
@item soxr
|
||||
select the SoX Resampler (where available); compensation, and filter options
|
||||
filter_size, phase_shift, exact_rational, filter_type & kaiser_beta, are not
|
||||
applicable in this case.
|
||||
filter_size, phase_shift, filter_type & kaiser_beta, are not applicable in this
|
||||
case.
|
||||
@end table
|
||||
|
||||
@item filter_size
|
||||
@@ -134,11 +134,6 @@ the interval [0,30].
|
||||
@item linear_interp
|
||||
Use linear interpolation if set to 1, default value is 0.
|
||||
|
||||
@item exact_rational
|
||||
For swr only, when enabled, try to use exact phase_count based on input and
|
||||
output sample rate. However, if it is larger than @code{1 << phase_shift},
|
||||
the phase_count will be @code{1 << phase_shift} as fallback. Default is disabled.
|
||||
|
||||
@item cutoff
|
||||
Set cutoff frequency (swr: 6dB point; soxr: 0dB point) ratio; must be a float
|
||||
value between 0 and 1. Default value is 0.97 with swr, and 0.91 with soxr
|
||||
|
||||
@@ -527,7 +527,7 @@ Wavelet Transform:
|
||||
==================
|
||||
|
||||
Snow supports 2 wavelet transforms, the symmetric biorthogonal 5/3 integer
|
||||
transform and an integer approximation of the symmetric biorthogonal 9/7
|
||||
transform and a integer approximation of the symmetric biorthogonal 9/7
|
||||
daubechies wavelet.
|
||||
|
||||
2D IDWT (inverse discrete wavelet transform)
|
||||
|
||||
@@ -10,12 +10,12 @@ Current (simplified) Architecture:
|
||||
/ \
|
||||
special converter [Input to YUV converter]
|
||||
| |
|
||||
| (8-bit YUV 4:4:4 / 4:2:2 / 4:2:0 / 4:0:0 )
|
||||
| (8bit YUV 4:4:4 / 4:2:2 / 4:2:0 / 4:0:0 )
|
||||
| |
|
||||
| v
|
||||
| Horizontal scaler
|
||||
| |
|
||||
| (15-bit YUV 4:4:4 / 4:2:2 / 4:2:0 / 4:1:1 / 4:0:0 )
|
||||
| (15bit YUV 4:4:4 / 4:2:2 / 4:2:0 / 4:1:1 / 4:0:0 )
|
||||
| |
|
||||
| v
|
||||
| Vertical scaler and output converter
|
||||
|
||||
@@ -22,7 +22,7 @@ EOT
|
||||
my $TEMPLATE_HEADER2 = $ENV{"FFMPEG_HEADER2"} || <<EOT;
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<div style="width: 95%; margin: auto">
|
||||
EOT
|
||||
|
||||
my $TEMPLATE_FOOTER = $ENV{"FFMPEG_FOOTER"} || <<EOT;
|
||||
|
||||
@@ -174,7 +174,7 @@ EOT
|
||||
<link rel="stylesheet" type="text/css" href="style.min.css">
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<div style="width: 95%; margin: auto">
|
||||
<h1>
|
||||
EOT
|
||||
|
||||
|
||||
@@ -869,7 +869,7 @@ Return 1 if @var{x} is lesser than or equal to @var{y}, 0 otherwise.
|
||||
Return the maximum between @var{x} and @var{y}.
|
||||
|
||||
@item min(x, y)
|
||||
Return the minimum between @var{x} and @var{y}.
|
||||
Return the maximum between @var{x} and @var{y}.
|
||||
|
||||
@item mod(x, y)
|
||||
Compute the remainder of division of @var{x} by @var{y}.
|
||||
|
||||
43
ffmpeg.h
43
ffmpeg.h
@@ -65,8 +65,6 @@ enum HWAccelID {
|
||||
HWACCEL_VDA,
|
||||
HWACCEL_VIDEOTOOLBOX,
|
||||
HWACCEL_QSV,
|
||||
HWACCEL_VAAPI,
|
||||
HWACCEL_CUVID,
|
||||
};
|
||||
|
||||
typedef struct HWAccel {
|
||||
@@ -128,8 +126,6 @@ typedef struct OptionsContext {
|
||||
int nb_hwaccels;
|
||||
SpecifierOpt *hwaccel_devices;
|
||||
int nb_hwaccel_devices;
|
||||
SpecifierOpt *hwaccel_output_formats;
|
||||
int nb_hwaccel_output_formats;
|
||||
SpecifierOpt *autorotate;
|
||||
int nb_autorotate;
|
||||
|
||||
@@ -212,8 +208,6 @@ typedef struct OptionsContext {
|
||||
int nb_pass;
|
||||
SpecifierOpt *passlogfiles;
|
||||
int nb_passlogfiles;
|
||||
SpecifierOpt *max_muxing_queue_size;
|
||||
int nb_max_muxing_queue_size;
|
||||
SpecifierOpt *guess_layout_max;
|
||||
int nb_guess_layout_max;
|
||||
SpecifierOpt *apad;
|
||||
@@ -289,6 +283,7 @@ typedef struct InputStream {
|
||||
|
||||
double ts_scale;
|
||||
int saw_first_ts;
|
||||
int showed_multi_packet_warning;
|
||||
AVDictionary *decoder_opts;
|
||||
AVRational framerate; /* framerate forced with -r */
|
||||
int top_field_first;
|
||||
@@ -330,7 +325,6 @@ typedef struct InputStream {
|
||||
/* hwaccel options */
|
||||
enum HWAccelID hwaccel_id;
|
||||
char *hwaccel_device;
|
||||
enum AVPixelFormat hwaccel_output_format;
|
||||
|
||||
/* hwaccel context */
|
||||
enum HWAccelID active_hwaccel_id;
|
||||
@@ -340,7 +334,6 @@ typedef struct InputStream {
|
||||
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
|
||||
@@ -350,9 +343,6 @@ typedef struct InputStream {
|
||||
// number of frames/samples retrieved from the decoder
|
||||
uint64_t frames_decoded;
|
||||
uint64_t samples_decoded;
|
||||
|
||||
int64_t *dts_buffer;
|
||||
int nb_dts_buffer;
|
||||
} InputStream;
|
||||
|
||||
typedef struct InputFile {
|
||||
@@ -420,13 +410,8 @@ typedef struct OutputStream {
|
||||
int64_t first_pts;
|
||||
/* dts of the last packet sent to the muxer */
|
||||
int64_t last_mux_dts;
|
||||
|
||||
int nb_bitstream_filters;
|
||||
uint8_t *bsf_extradata_updated;
|
||||
AVBSFContext **bsf_ctx;
|
||||
|
||||
AVBitStreamFilterContext *bitstream_filters;
|
||||
AVCodecContext *enc_ctx;
|
||||
AVCodecParameters *ref_par; /* associated input codec parameters with encoders options applied */
|
||||
AVCodec *enc;
|
||||
int64_t max_frames;
|
||||
AVFrame *filtered_frame;
|
||||
@@ -473,12 +458,6 @@ typedef struct OutputStream {
|
||||
OSTFinished finished; /* no more packets should be written for this stream */
|
||||
int unavailable; /* true if the steram is unavailable (possibly temporarily) */
|
||||
int stream_copy;
|
||||
|
||||
// init_output_stream() has been called for this stream
|
||||
// The encoder and the bitstream filters have been initialized and the stream
|
||||
// parameters are set in the AVStream.
|
||||
int initialized;
|
||||
|
||||
const char *attachment_filename;
|
||||
int copy_initial_nonkeyframes;
|
||||
int copy_prior_start;
|
||||
@@ -487,7 +466,6 @@ typedef struct OutputStream {
|
||||
int keep_pix_fmt;
|
||||
|
||||
AVCodecParserContext *parser;
|
||||
AVCodecContext *parser_avctx;
|
||||
|
||||
/* stats */
|
||||
// combined size of all the packets written
|
||||
@@ -501,11 +479,6 @@ typedef struct OutputStream {
|
||||
/* packet quality factor */
|
||||
int quality;
|
||||
|
||||
int max_muxing_queue_size;
|
||||
|
||||
/* the packets are buffered here until the muxer is ready to be initialized */
|
||||
AVFifoBuffer *muxing_queue;
|
||||
|
||||
/* packet picture type */
|
||||
int pict_type;
|
||||
|
||||
@@ -522,8 +495,6 @@ typedef struct OutputFile {
|
||||
uint64_t limit_filesize; /* filesize limit expressed in bytes */
|
||||
|
||||
int shortest;
|
||||
|
||||
int header_written;
|
||||
} OutputFile;
|
||||
|
||||
extern InputStream **input_streams;
|
||||
@@ -567,14 +538,13 @@ extern int stdin_interaction;
|
||||
extern int frame_bits_per_raw_sample;
|
||||
extern AVIOContext *progress_avio;
|
||||
extern float max_error_rate;
|
||||
extern int vdpau_api_ver;
|
||||
extern char *videotoolbox_pixfmt;
|
||||
|
||||
extern const AVIOInterruptCB int_cb;
|
||||
|
||||
extern const OptionDef options[];
|
||||
extern const HWAccel hwaccels[];
|
||||
extern int hwaccel_lax_profile_check;
|
||||
extern AVBufferRef *hw_device_ctx;
|
||||
|
||||
|
||||
void term_init(void);
|
||||
@@ -596,8 +566,7 @@ void choose_sample_fmt(AVStream *st, AVCodec *codec);
|
||||
int configure_filtergraph(FilterGraph *fg);
|
||||
int configure_output_filter(FilterGraph *fg, OutputFilter *ofilter, AVFilterInOut *out);
|
||||
int ist_in_filtergraph(FilterGraph *fg, InputStream *ist);
|
||||
int filtergraph_is_simple(FilterGraph *fg);
|
||||
int init_simple_filtergraph(InputStream *ist, OutputStream *ost);
|
||||
FilterGraph *init_simple_filtergraph(InputStream *ist, OutputStream *ost);
|
||||
int init_complex_filtergraph(FilterGraph *fg);
|
||||
|
||||
int ffmpeg_parse_options(int argc, char **argv);
|
||||
@@ -608,9 +577,5 @@ int vda_init(AVCodecContext *s);
|
||||
int videotoolbox_init(AVCodecContext *s);
|
||||
int qsv_init(AVCodecContext *s);
|
||||
int qsv_transcode_init(OutputStream *ost);
|
||||
int vaapi_decode_init(AVCodecContext *avctx);
|
||||
int vaapi_device_init(const char *device);
|
||||
int cuvid_init(AVCodecContext *s);
|
||||
int cuvid_transcode_init(OutputStream *ost);
|
||||
|
||||
#endif /* FFMPEG_H */
|
||||
|
||||
155
ffmpeg_cuvid.c
155
ffmpeg_cuvid.c
@@ -1,155 +0,0 @@
|
||||
/*
|
||||
* 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 "libavutil/hwcontext.h"
|
||||
|
||||
#include "ffmpeg.h"
|
||||
|
||||
typedef struct CUVIDContext {
|
||||
AVBufferRef *hw_frames_ctx;
|
||||
} CUVIDContext;
|
||||
|
||||
static void cuvid_uninit(AVCodecContext *avctx)
|
||||
{
|
||||
InputStream *ist = avctx->opaque;
|
||||
CUVIDContext *ctx = ist->hwaccel_ctx;
|
||||
|
||||
if (ctx) {
|
||||
av_buffer_unref(&ctx->hw_frames_ctx);
|
||||
av_freep(&ctx);
|
||||
}
|
||||
|
||||
av_buffer_unref(&ist->hw_frames_ctx);
|
||||
|
||||
ist->hwaccel_ctx = 0;
|
||||
ist->hwaccel_uninit = 0;
|
||||
}
|
||||
|
||||
int cuvid_init(AVCodecContext *avctx)
|
||||
{
|
||||
InputStream *ist = avctx->opaque;
|
||||
CUVIDContext *ctx = ist->hwaccel_ctx;
|
||||
|
||||
av_log(NULL, AV_LOG_TRACE, "Initializing cuvid hwaccel\n");
|
||||
|
||||
if (!ctx) {
|
||||
av_log(NULL, AV_LOG_ERROR, "CUVID transcoding is not initialized. "
|
||||
"-hwaccel cuvid should only be used for one-to-one CUVID transcoding "
|
||||
"with no (software) filters.\n");
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int cuvid_transcode_init(OutputStream *ost)
|
||||
{
|
||||
InputStream *ist;
|
||||
const enum AVPixelFormat *pix_fmt;
|
||||
AVHWFramesContext *hwframe_ctx;
|
||||
AVBufferRef *device_ref = NULL;
|
||||
CUVIDContext *ctx = NULL;
|
||||
int ret = 0;
|
||||
|
||||
av_log(NULL, AV_LOG_TRACE, "Initializing cuvid transcoding\n");
|
||||
|
||||
if (ost->source_index < 0)
|
||||
return 0;
|
||||
|
||||
ist = input_streams[ost->source_index];
|
||||
|
||||
/* check if the encoder supports CUVID */
|
||||
if (!ost->enc->pix_fmts)
|
||||
goto cancel;
|
||||
for (pix_fmt = ost->enc->pix_fmts; *pix_fmt != AV_PIX_FMT_NONE; pix_fmt++)
|
||||
if (*pix_fmt == AV_PIX_FMT_CUDA)
|
||||
break;
|
||||
if (*pix_fmt == AV_PIX_FMT_NONE)
|
||||
goto cancel;
|
||||
|
||||
/* check if the decoder supports CUVID */
|
||||
if (ist->hwaccel_id != HWACCEL_CUVID || !ist->dec || !ist->dec->pix_fmts)
|
||||
goto cancel;
|
||||
for (pix_fmt = ist->dec->pix_fmts; *pix_fmt != AV_PIX_FMT_NONE; pix_fmt++)
|
||||
if (*pix_fmt == AV_PIX_FMT_CUDA)
|
||||
break;
|
||||
if (*pix_fmt == AV_PIX_FMT_NONE)
|
||||
goto cancel;
|
||||
|
||||
av_log(NULL, AV_LOG_VERBOSE, "Setting up CUVID transcoding\n");
|
||||
|
||||
if (ist->hwaccel_ctx) {
|
||||
ctx = ist->hwaccel_ctx;
|
||||
} else {
|
||||
ctx = av_mallocz(sizeof(*ctx));
|
||||
if (!ctx) {
|
||||
ret = AVERROR(ENOMEM);
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
|
||||
if (!ctx->hw_frames_ctx) {
|
||||
ret = av_hwdevice_ctx_create(&device_ref, AV_HWDEVICE_TYPE_CUDA,
|
||||
ist->hwaccel_device, NULL, 0);
|
||||
if (ret < 0)
|
||||
goto error;
|
||||
|
||||
ctx->hw_frames_ctx = av_hwframe_ctx_alloc(device_ref);
|
||||
if (!ctx->hw_frames_ctx) {
|
||||
av_log(NULL, AV_LOG_ERROR, "av_hwframe_ctx_alloc failed\n");
|
||||
ret = AVERROR(ENOMEM);
|
||||
goto error;
|
||||
}
|
||||
av_buffer_unref(&device_ref);
|
||||
|
||||
ist->hw_frames_ctx = av_buffer_ref(ctx->hw_frames_ctx);
|
||||
if (!ist->hw_frames_ctx) {
|
||||
av_log(NULL, AV_LOG_ERROR, "av_buffer_ref failed\n");
|
||||
ret = AVERROR(ENOMEM);
|
||||
goto error;
|
||||
}
|
||||
|
||||
ist->hwaccel_ctx = ctx;
|
||||
ist->resample_pix_fmt = AV_PIX_FMT_CUDA;
|
||||
ist->hwaccel_uninit = cuvid_uninit;
|
||||
|
||||
/* This is a bit hacky, av_hwframe_ctx_init is called by the cuvid decoder
|
||||
* once it has probed the necessary format information. But as filters/nvenc
|
||||
* need to know the format/sw_format, set them here so they are happy.
|
||||
* This is fine as long as CUVID doesn't add another supported pix_fmt.
|
||||
*/
|
||||
hwframe_ctx = (AVHWFramesContext*)ctx->hw_frames_ctx->data;
|
||||
hwframe_ctx->format = AV_PIX_FMT_CUDA;
|
||||
hwframe_ctx->sw_format = AV_PIX_FMT_NV12;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
error:
|
||||
av_freep(&ctx);
|
||||
av_buffer_unref(&device_ref);
|
||||
return ret;
|
||||
|
||||
cancel:
|
||||
if (ist->hwaccel_id == HWACCEL_CUVID) {
|
||||
av_log(NULL, AV_LOG_ERROR, "CUVID hwaccel requested, but impossible to achieve.\n");
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
340
ffmpeg_dxva2.c
340
ffmpeg_dxva2.c
@@ -40,9 +40,6 @@
|
||||
#include "libavutil/imgutils.h"
|
||||
#include "libavutil/pixfmt.h"
|
||||
|
||||
#include "libavutil/hwcontext.h"
|
||||
#include "libavutil/hwcontext_dxva2.h"
|
||||
|
||||
/* define all the GUIDs used directly here,
|
||||
to avoid problems with inconsistent dxva2api.h versions in mingw-w64 and different MSVC version */
|
||||
#include <initguid.h>
|
||||
@@ -56,11 +53,13 @@ DEFINE_GUID(DXVADDI_Intel_ModeH264_E, 0x604F8E68, 0x4951,0x4C54,0x88,0xFE,0xAB,0
|
||||
DEFINE_GUID(DXVA2_ModeVC1_D, 0x1b81beA3, 0xa0c7,0x11d3,0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5);
|
||||
DEFINE_GUID(DXVA2_ModeVC1_D2010, 0x1b81beA4, 0xa0c7,0x11d3,0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5);
|
||||
DEFINE_GUID(DXVA2_ModeHEVC_VLD_Main, 0x5b11d51b, 0x2f4c,0x4452,0xbc,0xc3,0x09,0xf2,0xa1,0x16,0x0c,0xc0);
|
||||
DEFINE_GUID(DXVA2_ModeHEVC_VLD_Main10,0x107af0e0, 0xef1a,0x4d19,0xab,0xa8,0x67,0xa1,0x63,0x07,0x3d,0x13);
|
||||
DEFINE_GUID(DXVA2_ModeVP9_VLD_Profile0, 0x463707f8, 0xa1d0,0x4585,0x87,0x6d,0x83,0xaa,0x6d,0x60,0xb8,0x9e);
|
||||
DEFINE_GUID(DXVA2_NoEncrypt, 0x1b81beD0, 0xa0c7,0x11d3,0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5);
|
||||
DEFINE_GUID(GUID_NULL, 0x00000000, 0x0000,0x0000,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00);
|
||||
|
||||
typedef IDirect3D9* WINAPI pDirect3DCreate9(UINT);
|
||||
typedef HRESULT WINAPI pCreateDeviceManager9(UINT *, IDirect3DDeviceManager9 **);
|
||||
|
||||
typedef struct dxva2_mode {
|
||||
const GUID *guid;
|
||||
enum AVCodecID codec;
|
||||
@@ -85,7 +84,6 @@ static const dxva2_mode dxva2_modes[] = {
|
||||
|
||||
/* HEVC/H.265 */
|
||||
{ &DXVA2_ModeHEVC_VLD_Main, AV_CODEC_ID_HEVC },
|
||||
{ &DXVA2_ModeHEVC_VLD_Main10,AV_CODEC_ID_HEVC },
|
||||
|
||||
/* VP8/9 */
|
||||
{ &DXVA2_ModeVP9_VLD_Profile0, AV_CODEC_ID_VP9 },
|
||||
@@ -93,19 +91,63 @@ static const dxva2_mode dxva2_modes[] = {
|
||||
{ NULL, 0 },
|
||||
};
|
||||
|
||||
typedef struct surface_info {
|
||||
int used;
|
||||
uint64_t age;
|
||||
} surface_info;
|
||||
|
||||
typedef struct DXVA2Context {
|
||||
HMODULE d3dlib;
|
||||
HMODULE dxva2lib;
|
||||
|
||||
HANDLE deviceHandle;
|
||||
|
||||
IDirect3D9 *d3d9;
|
||||
IDirect3DDevice9 *d3d9device;
|
||||
IDirect3DDeviceManager9 *d3d9devmgr;
|
||||
IDirectXVideoDecoderService *decoder_service;
|
||||
IDirectXVideoDecoder *decoder;
|
||||
|
||||
GUID decoder_guid;
|
||||
DXVA2_ConfigPictureDecode decoder_config;
|
||||
IDirectXVideoDecoderService *decoder_service;
|
||||
|
||||
LPDIRECT3DSURFACE9 *surfaces;
|
||||
surface_info *surface_infos;
|
||||
uint32_t num_surfaces;
|
||||
uint64_t surface_age;
|
||||
|
||||
AVFrame *tmp_frame;
|
||||
|
||||
AVBufferRef *hw_device_ctx;
|
||||
AVBufferRef *hw_frames_ctx;
|
||||
} DXVA2Context;
|
||||
|
||||
typedef struct DXVA2SurfaceWrapper {
|
||||
DXVA2Context *ctx;
|
||||
LPDIRECT3DSURFACE9 surface;
|
||||
IDirectXVideoDecoder *decoder;
|
||||
} DXVA2SurfaceWrapper;
|
||||
|
||||
static void dxva2_destroy_decoder(AVCodecContext *s)
|
||||
{
|
||||
InputStream *ist = s->opaque;
|
||||
DXVA2Context *ctx = ist->hwaccel_ctx;
|
||||
int i;
|
||||
|
||||
if (ctx->surfaces) {
|
||||
for (i = 0; i < ctx->num_surfaces; i++) {
|
||||
if (ctx->surfaces[i])
|
||||
IDirect3DSurface9_Release(ctx->surfaces[i]);
|
||||
}
|
||||
}
|
||||
av_freep(&ctx->surfaces);
|
||||
av_freep(&ctx->surface_infos);
|
||||
ctx->num_surfaces = 0;
|
||||
ctx->surface_age = 0;
|
||||
|
||||
if (ctx->decoder) {
|
||||
IDirectXVideoDecoder_Release(ctx->decoder);
|
||||
ctx->decoder = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static void dxva2_uninit(AVCodecContext *s)
|
||||
{
|
||||
InputStream *ist = s->opaque;
|
||||
@@ -115,11 +157,29 @@ static void dxva2_uninit(AVCodecContext *s)
|
||||
ist->hwaccel_get_buffer = NULL;
|
||||
ist->hwaccel_retrieve_data = NULL;
|
||||
|
||||
if (ctx->decoder)
|
||||
dxva2_destroy_decoder(s);
|
||||
|
||||
if (ctx->decoder_service)
|
||||
IDirectXVideoDecoderService_Release(ctx->decoder_service);
|
||||
|
||||
av_buffer_unref(&ctx->hw_frames_ctx);
|
||||
av_buffer_unref(&ctx->hw_device_ctx);
|
||||
if (ctx->d3d9devmgr && ctx->deviceHandle != INVALID_HANDLE_VALUE)
|
||||
IDirect3DDeviceManager9_CloseDeviceHandle(ctx->d3d9devmgr, ctx->deviceHandle);
|
||||
|
||||
if (ctx->d3d9devmgr)
|
||||
IDirect3DDeviceManager9_Release(ctx->d3d9devmgr);
|
||||
|
||||
if (ctx->d3d9device)
|
||||
IDirect3DDevice9_Release(ctx->d3d9device);
|
||||
|
||||
if (ctx->d3d9)
|
||||
IDirect3D9_Release(ctx->d3d9);
|
||||
|
||||
if (ctx->d3dlib)
|
||||
FreeLibrary(ctx->d3dlib);
|
||||
|
||||
if (ctx->dxva2lib)
|
||||
FreeLibrary(ctx->dxva2lib);
|
||||
|
||||
av_frame_free(&ctx->tmp_frame);
|
||||
|
||||
@@ -127,34 +187,119 @@ static void dxva2_uninit(AVCodecContext *s)
|
||||
av_freep(&s->hwaccel_context);
|
||||
}
|
||||
|
||||
static void dxva2_release_buffer(void *opaque, uint8_t *data)
|
||||
{
|
||||
DXVA2SurfaceWrapper *w = opaque;
|
||||
DXVA2Context *ctx = w->ctx;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < ctx->num_surfaces; i++) {
|
||||
if (ctx->surfaces[i] == w->surface) {
|
||||
ctx->surface_infos[i].used = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
IDirect3DSurface9_Release(w->surface);
|
||||
IDirectXVideoDecoder_Release(w->decoder);
|
||||
av_free(w);
|
||||
}
|
||||
|
||||
static int dxva2_get_buffer(AVCodecContext *s, AVFrame *frame, int flags)
|
||||
{
|
||||
InputStream *ist = s->opaque;
|
||||
DXVA2Context *ctx = ist->hwaccel_ctx;
|
||||
int i, old_unused = -1;
|
||||
LPDIRECT3DSURFACE9 surface;
|
||||
DXVA2SurfaceWrapper *w = NULL;
|
||||
|
||||
return av_hwframe_get_buffer(ctx->hw_frames_ctx, frame, 0);
|
||||
av_assert0(frame->format == AV_PIX_FMT_DXVA2_VLD);
|
||||
|
||||
for (i = 0; i < ctx->num_surfaces; i++) {
|
||||
surface_info *info = &ctx->surface_infos[i];
|
||||
if (!info->used && (old_unused == -1 || info->age < ctx->surface_infos[old_unused].age))
|
||||
old_unused = i;
|
||||
}
|
||||
if (old_unused == -1) {
|
||||
av_log(NULL, AV_LOG_ERROR, "No free DXVA2 surface!\n");
|
||||
return AVERROR(ENOMEM);
|
||||
}
|
||||
i = old_unused;
|
||||
|
||||
surface = ctx->surfaces[i];
|
||||
|
||||
w = av_mallocz(sizeof(*w));
|
||||
if (!w)
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
frame->buf[0] = av_buffer_create((uint8_t*)surface, 0,
|
||||
dxva2_release_buffer, w,
|
||||
AV_BUFFER_FLAG_READONLY);
|
||||
if (!frame->buf[0]) {
|
||||
av_free(w);
|
||||
return AVERROR(ENOMEM);
|
||||
}
|
||||
|
||||
w->ctx = ctx;
|
||||
w->surface = surface;
|
||||
IDirect3DSurface9_AddRef(w->surface);
|
||||
w->decoder = ctx->decoder;
|
||||
IDirectXVideoDecoder_AddRef(w->decoder);
|
||||
|
||||
ctx->surface_infos[i].used = 1;
|
||||
ctx->surface_infos[i].age = ctx->surface_age++;
|
||||
|
||||
frame->data[3] = (uint8_t *)surface;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int dxva2_retrieve_data(AVCodecContext *s, AVFrame *frame)
|
||||
{
|
||||
LPDIRECT3DSURFACE9 surface = (LPDIRECT3DSURFACE9)frame->data[3];
|
||||
InputStream *ist = s->opaque;
|
||||
DXVA2Context *ctx = ist->hwaccel_ctx;
|
||||
D3DSURFACE_DESC surfaceDesc;
|
||||
D3DLOCKED_RECT LockedRect;
|
||||
HRESULT hr;
|
||||
int ret;
|
||||
|
||||
ret = av_hwframe_transfer_data(ctx->tmp_frame, frame, 0);
|
||||
IDirect3DSurface9_GetDesc(surface, &surfaceDesc);
|
||||
|
||||
ctx->tmp_frame->width = frame->width;
|
||||
ctx->tmp_frame->height = frame->height;
|
||||
ctx->tmp_frame->format = AV_PIX_FMT_NV12;
|
||||
|
||||
ret = av_frame_get_buffer(ctx->tmp_frame, 32);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
ret = av_frame_copy_props(ctx->tmp_frame, frame);
|
||||
if (ret < 0) {
|
||||
av_frame_unref(ctx->tmp_frame);
|
||||
return ret;
|
||||
hr = IDirect3DSurface9_LockRect(surface, &LockedRect, NULL, D3DLOCK_READONLY);
|
||||
if (FAILED(hr)) {
|
||||
av_log(NULL, AV_LOG_ERROR, "Unable to lock DXVA2 surface\n");
|
||||
return AVERROR_UNKNOWN;
|
||||
}
|
||||
|
||||
av_image_copy_plane(ctx->tmp_frame->data[0], ctx->tmp_frame->linesize[0],
|
||||
(uint8_t*)LockedRect.pBits,
|
||||
LockedRect.Pitch, frame->width, frame->height);
|
||||
|
||||
av_image_copy_plane(ctx->tmp_frame->data[1], ctx->tmp_frame->linesize[1],
|
||||
(uint8_t*)LockedRect.pBits + LockedRect.Pitch * surfaceDesc.Height,
|
||||
LockedRect.Pitch, frame->width, frame->height / 2);
|
||||
|
||||
IDirect3DSurface9_UnlockRect(surface);
|
||||
|
||||
ret = av_frame_copy_props(ctx->tmp_frame, frame);
|
||||
if (ret < 0)
|
||||
goto fail;
|
||||
|
||||
av_frame_unref(frame);
|
||||
av_frame_move_ref(frame, ctx->tmp_frame);
|
||||
|
||||
return 0;
|
||||
fail:
|
||||
av_frame_unref(ctx->tmp_frame);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int dxva2_alloc(AVCodecContext *s)
|
||||
@@ -162,40 +307,94 @@ static int dxva2_alloc(AVCodecContext *s)
|
||||
InputStream *ist = s->opaque;
|
||||
int loglevel = (ist->hwaccel_id == HWACCEL_AUTO) ? AV_LOG_VERBOSE : AV_LOG_ERROR;
|
||||
DXVA2Context *ctx;
|
||||
HANDLE device_handle;
|
||||
pDirect3DCreate9 *createD3D = NULL;
|
||||
pCreateDeviceManager9 *createDeviceManager = NULL;
|
||||
HRESULT hr;
|
||||
|
||||
AVHWDeviceContext *device_ctx;
|
||||
AVDXVA2DeviceContext *device_hwctx;
|
||||
int ret;
|
||||
D3DPRESENT_PARAMETERS d3dpp = {0};
|
||||
D3DDISPLAYMODE d3ddm;
|
||||
unsigned resetToken = 0;
|
||||
UINT adapter = D3DADAPTER_DEFAULT;
|
||||
|
||||
ctx = av_mallocz(sizeof(*ctx));
|
||||
if (!ctx)
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
ctx->deviceHandle = INVALID_HANDLE_VALUE;
|
||||
|
||||
ist->hwaccel_ctx = ctx;
|
||||
ist->hwaccel_uninit = dxva2_uninit;
|
||||
ist->hwaccel_get_buffer = dxva2_get_buffer;
|
||||
ist->hwaccel_retrieve_data = dxva2_retrieve_data;
|
||||
|
||||
ret = av_hwdevice_ctx_create(&ctx->hw_device_ctx, AV_HWDEVICE_TYPE_DXVA2,
|
||||
ist->hwaccel_device, NULL, 0);
|
||||
if (ret < 0)
|
||||
ctx->d3dlib = LoadLibrary("d3d9.dll");
|
||||
if (!ctx->d3dlib) {
|
||||
av_log(NULL, loglevel, "Failed to load D3D9 library\n");
|
||||
goto fail;
|
||||
device_ctx = (AVHWDeviceContext*)ctx->hw_device_ctx->data;
|
||||
device_hwctx = device_ctx->hwctx;
|
||||
|
||||
hr = IDirect3DDeviceManager9_OpenDeviceHandle(device_hwctx->devmgr,
|
||||
&device_handle);
|
||||
if (FAILED(hr)) {
|
||||
av_log(NULL, loglevel, "Failed to open a device handle\n");
|
||||
}
|
||||
ctx->dxva2lib = LoadLibrary("dxva2.dll");
|
||||
if (!ctx->dxva2lib) {
|
||||
av_log(NULL, loglevel, "Failed to load DXVA2 library\n");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
hr = IDirect3DDeviceManager9_GetVideoService(device_hwctx->devmgr, device_handle,
|
||||
&IID_IDirectXVideoDecoderService,
|
||||
(void **)&ctx->decoder_service);
|
||||
IDirect3DDeviceManager9_CloseDeviceHandle(device_hwctx->devmgr, device_handle);
|
||||
createD3D = (pDirect3DCreate9 *)GetProcAddress(ctx->d3dlib, "Direct3DCreate9");
|
||||
if (!createD3D) {
|
||||
av_log(NULL, loglevel, "Failed to locate Direct3DCreate9\n");
|
||||
goto fail;
|
||||
}
|
||||
createDeviceManager = (pCreateDeviceManager9 *)GetProcAddress(ctx->dxva2lib, "DXVA2CreateDirect3DDeviceManager9");
|
||||
if (!createDeviceManager) {
|
||||
av_log(NULL, loglevel, "Failed to locate DXVA2CreateDirect3DDeviceManager9\n");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
ctx->d3d9 = createD3D(D3D_SDK_VERSION);
|
||||
if (!ctx->d3d9) {
|
||||
av_log(NULL, loglevel, "Failed to create IDirect3D object\n");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (ist->hwaccel_device) {
|
||||
adapter = atoi(ist->hwaccel_device);
|
||||
av_log(NULL, AV_LOG_INFO, "Using HWAccel device %d\n", adapter);
|
||||
}
|
||||
|
||||
IDirect3D9_GetAdapterDisplayMode(ctx->d3d9, adapter, &d3ddm);
|
||||
d3dpp.Windowed = TRUE;
|
||||
d3dpp.BackBufferWidth = 640;
|
||||
d3dpp.BackBufferHeight = 480;
|
||||
d3dpp.BackBufferCount = 0;
|
||||
d3dpp.BackBufferFormat = d3ddm.Format;
|
||||
d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
|
||||
d3dpp.Flags = D3DPRESENTFLAG_VIDEO;
|
||||
|
||||
hr = IDirect3D9_CreateDevice(ctx->d3d9, adapter, D3DDEVTYPE_HAL, GetDesktopWindow(),
|
||||
D3DCREATE_SOFTWARE_VERTEXPROCESSING | D3DCREATE_MULTITHREADED | D3DCREATE_FPU_PRESERVE,
|
||||
&d3dpp, &ctx->d3d9device);
|
||||
if (FAILED(hr)) {
|
||||
av_log(NULL, loglevel, "Failed to create Direct3D device\n");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
hr = createDeviceManager(&resetToken, &ctx->d3d9devmgr);
|
||||
if (FAILED(hr)) {
|
||||
av_log(NULL, loglevel, "Failed to create Direct3D device manager\n");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
hr = IDirect3DDeviceManager9_ResetDevice(ctx->d3d9devmgr, ctx->d3d9device, resetToken);
|
||||
if (FAILED(hr)) {
|
||||
av_log(NULL, loglevel, "Failed to bind Direct3D device to device manager\n");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
hr = IDirect3DDeviceManager9_OpenDeviceHandle(ctx->d3d9devmgr, &ctx->deviceHandle);
|
||||
if (FAILED(hr)) {
|
||||
av_log(NULL, loglevel, "Failed to open device handle\n");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
hr = IDirect3DDeviceManager9_GetVideoService(ctx->d3d9devmgr, ctx->deviceHandle, &IID_IDirectXVideoDecoderService, (void **)&ctx->decoder_service);
|
||||
if (FAILED(hr)) {
|
||||
av_log(NULL, loglevel, "Failed to create IDirectXVideoDecoderService\n");
|
||||
goto fail;
|
||||
@@ -271,17 +470,13 @@ static int dxva2_create_decoder(AVCodecContext *s)
|
||||
GUID *guid_list = NULL;
|
||||
unsigned guid_count = 0, i, j;
|
||||
GUID device_guid = GUID_NULL;
|
||||
const D3DFORMAT surface_format = (s->sw_pix_fmt == AV_PIX_FMT_YUV420P10) ? MKTAG('P','0','1','0') : MKTAG('N','V','1','2');
|
||||
D3DFORMAT target_format = 0;
|
||||
DXVA2_VideoDesc desc = { 0 };
|
||||
DXVA2_ConfigPictureDecode config;
|
||||
HRESULT hr;
|
||||
int surface_alignment, num_surfaces;
|
||||
int surface_alignment;
|
||||
int ret;
|
||||
|
||||
AVDXVA2FramesContext *frames_hwctx;
|
||||
AVHWFramesContext *frames_ctx;
|
||||
|
||||
hr = IDirectXVideoDecoderService_GetDecoderDeviceGuids(ctx->decoder_service, &guid_count, &guid_list);
|
||||
if (FAILED(hr)) {
|
||||
av_log(NULL, loglevel, "Failed to retrieve decoder device GUIDs\n");
|
||||
@@ -308,7 +503,7 @@ static int dxva2_create_decoder(AVCodecContext *s)
|
||||
}
|
||||
for (j = 0; j < target_count; j++) {
|
||||
const D3DFORMAT format = target_list[j];
|
||||
if (format == surface_format) {
|
||||
if (format == MKTAG('N','V','1','2')) {
|
||||
target_format = format;
|
||||
break;
|
||||
}
|
||||
@@ -347,43 +542,43 @@ static int dxva2_create_decoder(AVCodecContext *s)
|
||||
surface_alignment = 16;
|
||||
|
||||
/* 4 base work surfaces */
|
||||
num_surfaces = 4;
|
||||
ctx->num_surfaces = 4;
|
||||
|
||||
/* add surfaces based on number of possible refs */
|
||||
if (s->codec_id == AV_CODEC_ID_H264 || s->codec_id == AV_CODEC_ID_HEVC)
|
||||
num_surfaces += 16;
|
||||
ctx->num_surfaces += 16;
|
||||
else if (s->codec_id == AV_CODEC_ID_VP9)
|
||||
num_surfaces += 8;
|
||||
ctx->num_surfaces += 8;
|
||||
else
|
||||
num_surfaces += 2;
|
||||
ctx->num_surfaces += 2;
|
||||
|
||||
/* add extra surfaces for frame threading */
|
||||
if (s->active_thread_type & FF_THREAD_FRAME)
|
||||
num_surfaces += s->thread_count;
|
||||
ctx->num_surfaces += s->thread_count;
|
||||
|
||||
ctx->hw_frames_ctx = av_hwframe_ctx_alloc(ctx->hw_device_ctx);
|
||||
if (!ctx->hw_frames_ctx)
|
||||
ctx->surfaces = av_mallocz(ctx->num_surfaces * sizeof(*ctx->surfaces));
|
||||
ctx->surface_infos = av_mallocz(ctx->num_surfaces * sizeof(*ctx->surface_infos));
|
||||
|
||||
if (!ctx->surfaces || !ctx->surface_infos) {
|
||||
av_log(NULL, loglevel, "Unable to allocate surface arrays\n");
|
||||
goto fail;
|
||||
frames_ctx = (AVHWFramesContext*)ctx->hw_frames_ctx->data;
|
||||
frames_hwctx = frames_ctx->hwctx;
|
||||
}
|
||||
|
||||
frames_ctx->format = AV_PIX_FMT_DXVA2_VLD;
|
||||
frames_ctx->sw_format = (target_format == MKTAG('P','0','1','0') ? AV_PIX_FMT_P010 : AV_PIX_FMT_NV12);
|
||||
frames_ctx->width = FFALIGN(s->coded_width, surface_alignment);
|
||||
frames_ctx->height = FFALIGN(s->coded_height, surface_alignment);
|
||||
frames_ctx->initial_pool_size = num_surfaces;
|
||||
|
||||
frames_hwctx->surface_type = DXVA2_VideoDecoderRenderTarget;
|
||||
|
||||
ret = av_hwframe_ctx_init(ctx->hw_frames_ctx);
|
||||
if (ret < 0) {
|
||||
av_log(NULL, loglevel, "Failed to initialize the HW frames context\n");
|
||||
hr = IDirectXVideoDecoderService_CreateSurface(ctx->decoder_service,
|
||||
FFALIGN(s->coded_width, surface_alignment),
|
||||
FFALIGN(s->coded_height, surface_alignment),
|
||||
ctx->num_surfaces - 1,
|
||||
target_format, D3DPOOL_DEFAULT, 0,
|
||||
DXVA2_VideoDecoderRenderTarget,
|
||||
ctx->surfaces, NULL);
|
||||
if (FAILED(hr)) {
|
||||
av_log(NULL, loglevel, "Failed to create %d video surfaces\n", ctx->num_surfaces);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
hr = IDirectXVideoDecoderService_CreateVideoDecoder(ctx->decoder_service, &device_guid,
|
||||
&desc, &config, frames_hwctx->surfaces,
|
||||
frames_hwctx->nb_surfaces, &frames_hwctx->decoder_to_release);
|
||||
&desc, &config, ctx->surfaces,
|
||||
ctx->num_surfaces, &ctx->decoder);
|
||||
if (FAILED(hr)) {
|
||||
av_log(NULL, loglevel, "Failed to create DXVA2 video decoder\n");
|
||||
goto fail;
|
||||
@@ -393,16 +588,16 @@ static int dxva2_create_decoder(AVCodecContext *s)
|
||||
ctx->decoder_config = config;
|
||||
|
||||
dxva_ctx->cfg = &ctx->decoder_config;
|
||||
dxva_ctx->decoder = frames_hwctx->decoder_to_release;
|
||||
dxva_ctx->surface = frames_hwctx->surfaces;
|
||||
dxva_ctx->surface_count = frames_hwctx->nb_surfaces;
|
||||
dxva_ctx->decoder = ctx->decoder;
|
||||
dxva_ctx->surface = ctx->surfaces;
|
||||
dxva_ctx->surface_count = ctx->num_surfaces;
|
||||
|
||||
if (IsEqualGUID(&ctx->decoder_guid, &DXVADDI_Intel_ModeH264_E))
|
||||
dxva_ctx->workaround |= FF_DXVA2_WORKAROUND_INTEL_CLEARVIDEO;
|
||||
|
||||
return 0;
|
||||
fail:
|
||||
av_buffer_unref(&ctx->hw_frames_ctx);
|
||||
dxva2_destroy_decoder(s);
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
|
||||
@@ -426,13 +621,8 @@ int dxva2_init(AVCodecContext *s)
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
|
||||
if (s->codec_id == AV_CODEC_ID_HEVC &&
|
||||
s->profile != FF_PROFILE_HEVC_MAIN && s->profile != FF_PROFILE_HEVC_MAIN_10) {
|
||||
av_log(NULL, loglevel, "Unsupported HEVC profile for DXVA2 HWAccel: %d\n", s->profile);
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
|
||||
av_buffer_unref(&ctx->hw_frames_ctx);
|
||||
if (ctx->decoder)
|
||||
dxva2_destroy_decoder(s);
|
||||
|
||||
ret = dxva2_create_decoder(s);
|
||||
if (ret < 0) {
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
|
||||
#include "libavfilter/avfilter.h"
|
||||
#include "libavfilter/buffersink.h"
|
||||
#include "libavfilter/buffersrc.h"
|
||||
|
||||
#include "libavresample/avresample.h"
|
||||
|
||||
@@ -39,6 +38,7 @@
|
||||
#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[])
|
||||
{
|
||||
static const enum AVPixelFormat mjpeg_formats[] =
|
||||
@@ -94,19 +94,19 @@ void choose_sample_fmt(AVStream *st, AVCodec *codec)
|
||||
if (codec && codec->sample_fmts) {
|
||||
const enum AVSampleFormat *p = codec->sample_fmts;
|
||||
for (; *p != -1; p++) {
|
||||
if (*p == st->codecpar->format)
|
||||
if (*p == st->codec->sample_fmt)
|
||||
break;
|
||||
}
|
||||
if (*p == -1) {
|
||||
if((codec->capabilities & AV_CODEC_CAP_LOSSLESS) && av_get_sample_fmt_name(st->codecpar->format) > av_get_sample_fmt_name(codec->sample_fmts[0]))
|
||||
if((codec->capabilities & AV_CODEC_CAP_LOSSLESS) && av_get_sample_fmt_name(st->codec->sample_fmt) > av_get_sample_fmt_name(codec->sample_fmts[0]))
|
||||
av_log(NULL, AV_LOG_ERROR, "Conversion will not be lossless.\n");
|
||||
if(av_get_sample_fmt_name(st->codecpar->format))
|
||||
if(av_get_sample_fmt_name(st->codec->sample_fmt))
|
||||
av_log(NULL, AV_LOG_WARNING,
|
||||
"Incompatible sample format '%s' for codec '%s', auto-selecting format '%s'\n",
|
||||
av_get_sample_fmt_name(st->codecpar->format),
|
||||
av_get_sample_fmt_name(st->codec->sample_fmt),
|
||||
codec->name,
|
||||
av_get_sample_fmt_name(codec->sample_fmts[0]));
|
||||
st->codecpar->format = codec->sample_fmts[0];
|
||||
st->codec->sample_fmt = codec->sample_fmts[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -193,7 +193,7 @@ DEF_CHOOSE_FORMAT(int, sample_rate, supported_samplerates, 0,
|
||||
DEF_CHOOSE_FORMAT(uint64_t, channel_layout, channel_layouts, 0,
|
||||
GET_CH_LAYOUT_NAME)
|
||||
|
||||
int init_simple_filtergraph(InputStream *ist, OutputStream *ost)
|
||||
FilterGraph *init_simple_filtergraph(InputStream *ist, OutputStream *ost)
|
||||
{
|
||||
FilterGraph *fg = av_mallocz(sizeof(*fg));
|
||||
|
||||
@@ -221,7 +221,7 @@ int init_simple_filtergraph(InputStream *ist, OutputStream *ost)
|
||||
GROW_ARRAY(filtergraphs, nb_filtergraphs);
|
||||
filtergraphs[nb_filtergraphs - 1] = fg;
|
||||
|
||||
return 0;
|
||||
return fg;
|
||||
}
|
||||
|
||||
static void init_input_filter(FilterGraph *fg, AVFilterInOut *in)
|
||||
@@ -251,7 +251,7 @@ static void init_input_filter(FilterGraph *fg, AVFilterInOut *in)
|
||||
s = input_files[file_idx]->ctx;
|
||||
|
||||
for (i = 0; i < s->nb_streams; i++) {
|
||||
enum AVMediaType stream_type = s->streams[i]->codecpar->codec_type;
|
||||
enum AVMediaType stream_type = s->streams[i]->codec->codec_type;
|
||||
if (stream_type != type &&
|
||||
!(stream_type == AVMEDIA_TYPE_SUBTITLE &&
|
||||
type == AVMEDIA_TYPE_VIDEO /* sub2video hack */))
|
||||
@@ -428,7 +428,7 @@ static int configure_output_video_filter(FilterGraph *fg, OutputFilter *ofilter,
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
if (!hw_device_ctx && (codec->width || codec->height)) {
|
||||
if (codec->width || codec->height) {
|
||||
char args[255];
|
||||
AVFilterContext *filter;
|
||||
AVDictionaryEntry *e = NULL;
|
||||
@@ -611,7 +611,7 @@ static int configure_output_audio_filter(FilterGraph *fg, OutputFilter *ofilter,
|
||||
int i;
|
||||
|
||||
for (i=0; i<of->ctx->nb_streams; i++)
|
||||
if (of->ctx->streams[i]->codecpar->codec_type == AVMEDIA_TYPE_VIDEO)
|
||||
if (of->ctx->streams[i]->codec->codec_type == AVMEDIA_TYPE_VIDEO)
|
||||
break;
|
||||
|
||||
if (i<of->ctx->nb_streams) {
|
||||
@@ -656,7 +656,7 @@ int configure_output_filter(FilterGraph *fg, OutputFilter *ofilter, AVFilterInOu
|
||||
DESCRIBE_FILTER_LINK(ofilter, out, 0);
|
||||
|
||||
if (!ofilter->ost) {
|
||||
av_log(NULL, AV_LOG_FATAL, "Filter %s has an unconnected output\n", ofilter->name);
|
||||
av_log(NULL, AV_LOG_FATAL, "Filter %s has a unconnected output\n", ofilter->name);
|
||||
exit_program(1);
|
||||
}
|
||||
|
||||
@@ -673,15 +673,15 @@ static int sub2video_prepare(InputStream *ist)
|
||||
int i, w, h;
|
||||
|
||||
/* Compute the size of the canvas for the subtitles stream.
|
||||
If the subtitles codecpar has set a size, use it. Otherwise use the
|
||||
If the subtitles codec has set a size, use it. Otherwise use the
|
||||
maximum dimensions of the video streams in the same file. */
|
||||
w = ist->dec_ctx->width;
|
||||
h = ist->dec_ctx->height;
|
||||
if (!(w && h)) {
|
||||
for (i = 0; i < avf->nb_streams; i++) {
|
||||
if (avf->streams[i]->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) {
|
||||
w = FFMAX(w, avf->streams[i]->codecpar->width);
|
||||
h = FFMAX(h, avf->streams[i]->codecpar->height);
|
||||
if (avf->streams[i]->codec->codec_type == AVMEDIA_TYPE_VIDEO) {
|
||||
w = FFMAX(w, avf->streams[i]->codec->width);
|
||||
h = FFMAX(h, avf->streams[i]->codec->height);
|
||||
}
|
||||
}
|
||||
if (!(w && h)) {
|
||||
@@ -719,17 +719,10 @@ static int configure_input_video_filter(FilterGraph *fg, InputFilter *ifilter,
|
||||
char name[255];
|
||||
int ret, pad_idx = 0;
|
||||
int64_t tsoffset = 0;
|
||||
AVBufferSrcParameters *par = av_buffersrc_parameters_alloc();
|
||||
|
||||
if (!par)
|
||||
return AVERROR(ENOMEM);
|
||||
memset(par, 0, sizeof(*par));
|
||||
par->format = AV_PIX_FMT_NONE;
|
||||
|
||||
if (ist->dec_ctx->codec_type == AVMEDIA_TYPE_AUDIO) {
|
||||
av_log(NULL, AV_LOG_ERROR, "Cannot connect video filter to audio input\n");
|
||||
ret = AVERROR(EINVAL);
|
||||
goto fail;
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
|
||||
if (!fr.num)
|
||||
@@ -738,7 +731,7 @@ static int configure_input_video_filter(FilterGraph *fg, InputFilter *ifilter,
|
||||
if (ist->dec_ctx->codec_type == AVMEDIA_TYPE_SUBTITLE) {
|
||||
ret = sub2video_prepare(ist);
|
||||
if (ret < 0)
|
||||
goto fail;
|
||||
return ret;
|
||||
}
|
||||
|
||||
sar = ist->st->sample_aspect_ratio.num ?
|
||||
@@ -759,15 +752,9 @@ static int configure_input_video_filter(FilterGraph *fg, InputFilter *ifilter,
|
||||
snprintf(name, sizeof(name), "graph %d input from stream %d:%d", fg->index,
|
||||
ist->file_index, ist->st->index);
|
||||
|
||||
|
||||
if ((ret = avfilter_graph_create_filter(&ifilter->filter, buffer_filt, name,
|
||||
args.str, NULL, fg->graph)) < 0)
|
||||
goto fail;
|
||||
par->hw_frames_ctx = ist->hw_frames_ctx;
|
||||
ret = av_buffersrc_parameters_set(ifilter->filter, par);
|
||||
if (ret < 0)
|
||||
goto fail;
|
||||
av_freep(&par);
|
||||
return ret;
|
||||
last_filter = ifilter->filter;
|
||||
|
||||
if (ist->autorotate) {
|
||||
@@ -841,10 +828,6 @@ static int configure_input_video_filter(FilterGraph *fg, InputFilter *ifilter,
|
||||
if ((ret = avfilter_link(last_filter, 0, in->filter_ctx, in->pad_idx)) < 0)
|
||||
return ret;
|
||||
return 0;
|
||||
fail:
|
||||
av_freep(&par);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int configure_input_audio_filter(FilterGraph *fg, InputFilter *ifilter,
|
||||
@@ -979,7 +962,7 @@ static int configure_input_filter(FilterGraph *fg, InputFilter *ifilter,
|
||||
int configure_filtergraph(FilterGraph *fg)
|
||||
{
|
||||
AVFilterInOut *inputs, *outputs, *cur;
|
||||
int ret, i, simple = filtergraph_is_simple(fg);
|
||||
int ret, i, simple = !fg->graph_desc;
|
||||
const char *graph_desc = simple ? fg->outputs[0]->ost->avfilter :
|
||||
fg->graph_desc;
|
||||
|
||||
@@ -1027,12 +1010,6 @@ int configure_filtergraph(FilterGraph *fg)
|
||||
if ((ret = avfilter_graph_parse2(fg->graph, graph_desc, &inputs, &outputs)) < 0)
|
||||
return ret;
|
||||
|
||||
if (hw_device_ctx) {
|
||||
for (i = 0; i < fg->graph->nb_filters; i++) {
|
||||
fg->graph->filters[i]->hw_device_ctx = av_buffer_ref(hw_device_ctx);
|
||||
}
|
||||
}
|
||||
|
||||
if (simple && (!inputs || inputs->next || !outputs || outputs->next)) {
|
||||
const char *num_inputs;
|
||||
const char *num_outputs;
|
||||
@@ -1081,7 +1058,7 @@ int configure_filtergraph(FilterGraph *fg)
|
||||
/* identical to the same check in ffmpeg.c, needed because
|
||||
complex filter graphs are initialized earlier */
|
||||
av_log(NULL, AV_LOG_ERROR, "Encoder (codec %s) not found for output stream #%d:%d\n",
|
||||
avcodec_get_name(ost->st->codecpar->codec_id), ost->file_index, ost->index);
|
||||
avcodec_get_name(ost->st->codec->codec_id), ost->file_index, ost->index);
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
if (ost->enc->type == AVMEDIA_TYPE_AUDIO &&
|
||||
@@ -1102,7 +1079,3 @@ int ist_in_filtergraph(FilterGraph *fg, InputStream *ist)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int filtergraph_is_simple(FilterGraph *fg)
|
||||
{
|
||||
return !fg->graph_desc;
|
||||
}
|
||||
|
||||
341
ffmpeg_opt.c
341
ffmpeg_opt.c
@@ -40,6 +40,7 @@
|
||||
#include "libavutil/parseutils.h"
|
||||
#include "libavutil/pixdesc.h"
|
||||
#include "libavutil/pixfmt.h"
|
||||
#include "libavutil/time_internal.h"
|
||||
|
||||
#define DEFAULT_PASS_LOGFILENAME_PREFIX "ffmpeg2pass"
|
||||
|
||||
@@ -80,17 +81,9 @@ const HWAccel hwaccels[] = {
|
||||
#endif
|
||||
#if CONFIG_LIBMFX
|
||||
{ "qsv", qsv_init, HWACCEL_QSV, AV_PIX_FMT_QSV },
|
||||
#endif
|
||||
#if CONFIG_VAAPI
|
||||
{ "vaapi", vaapi_decode_init, HWACCEL_VAAPI, AV_PIX_FMT_VAAPI },
|
||||
#endif
|
||||
#if CONFIG_CUVID
|
||||
{ "cuvid", cuvid_init, HWACCEL_CUVID, AV_PIX_FMT_CUDA },
|
||||
#endif
|
||||
{ 0 },
|
||||
};
|
||||
int hwaccel_lax_profile_check = 0;
|
||||
AVBufferRef *hw_device_ctx;
|
||||
|
||||
char *vstats_filename;
|
||||
char *sdp_filename;
|
||||
@@ -429,12 +422,12 @@ static int opt_map_channel(void *optctx, const char *opt, const char *arg)
|
||||
exit_program(1);
|
||||
}
|
||||
st = input_files[m->file_idx]->ctx->streams[m->stream_idx];
|
||||
if (st->codecpar->codec_type != AVMEDIA_TYPE_AUDIO) {
|
||||
if (st->codec->codec_type != AVMEDIA_TYPE_AUDIO) {
|
||||
av_log(NULL, AV_LOG_FATAL, "mapchan: stream #%d.%d is not an audio stream.\n",
|
||||
m->file_idx, m->stream_idx);
|
||||
exit_program(1);
|
||||
}
|
||||
if (m->channel_idx < 0 || m->channel_idx >= st->codecpar->channels) {
|
||||
if (m->channel_idx < 0 || m->channel_idx >= st->codec->channels) {
|
||||
av_log(NULL, AV_LOG_FATAL, "mapchan: invalid audio channel #%d.%d.%d\n",
|
||||
m->file_idx, m->stream_idx, m->channel_idx);
|
||||
exit_program(1);
|
||||
@@ -449,17 +442,6 @@ static int opt_sdp_file(void *optctx, const char *opt, const char *arg)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if CONFIG_VAAPI
|
||||
static int opt_vaapi_device(void *optctx, const char *opt, const char *arg)
|
||||
{
|
||||
int err;
|
||||
err = vaapi_device_init(arg);
|
||||
if (err < 0)
|
||||
exit_program(1);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Parse a metadata specifier passed as 'arg' parameter.
|
||||
* @param arg metadata string to parse
|
||||
@@ -634,11 +616,11 @@ static AVCodec *choose_decoder(OptionsContext *o, AVFormatContext *s, AVStream *
|
||||
|
||||
MATCH_PER_STREAM_OPT(codec_names, str, codec_name, s, st);
|
||||
if (codec_name) {
|
||||
AVCodec *codec = find_codec_or_die(codec_name, st->codecpar->codec_type, 0);
|
||||
st->codecpar->codec_id = codec->id;
|
||||
AVCodec *codec = find_codec_or_die(codec_name, st->codec->codec_type, 0);
|
||||
st->codec->codec_id = codec->id;
|
||||
return codec;
|
||||
} else
|
||||
return avcodec_find_decoder(st->codecpar->codec_id);
|
||||
return avcodec_find_decoder(st->codec->codec_id);
|
||||
}
|
||||
|
||||
/* Add all the streams from the given input file to the global
|
||||
@@ -649,15 +631,13 @@ static void add_input_streams(OptionsContext *o, AVFormatContext *ic)
|
||||
|
||||
for (i = 0; i < ic->nb_streams; i++) {
|
||||
AVStream *st = ic->streams[i];
|
||||
AVCodecParameters *par = st->codecpar;
|
||||
AVCodecContext *dec = st->codec;
|
||||
InputStream *ist = av_mallocz(sizeof(*ist));
|
||||
char *framerate = NULL, *hwaccel = NULL, *hwaccel_device = NULL;
|
||||
char *hwaccel_output_format = NULL;
|
||||
char *codec_tag = NULL;
|
||||
char *next;
|
||||
char *discard_str = NULL;
|
||||
const AVClass *cc = avcodec_get_class();
|
||||
const AVOption *discard_opt = av_opt_find(&cc, "skip_frame", NULL, 0, 0);
|
||||
const AVOption *discard_opt = av_opt_find(dec, "skip_frame", NULL, 0, 0);
|
||||
|
||||
if (!ist)
|
||||
exit_program(1);
|
||||
@@ -684,18 +664,18 @@ static void add_input_streams(OptionsContext *o, AVFormatContext *ic)
|
||||
uint32_t tag = strtol(codec_tag, &next, 0);
|
||||
if (*next)
|
||||
tag = AV_RL32(codec_tag);
|
||||
st->codecpar->codec_tag = tag;
|
||||
st->codec->codec_tag = tag;
|
||||
}
|
||||
|
||||
ist->dec = choose_decoder(o, ic, st);
|
||||
ist->decoder_opts = filter_codec_opts(o->g->codec_opts, ist->st->codecpar->codec_id, ic, st, ist->dec);
|
||||
ist->decoder_opts = filter_codec_opts(o->g->codec_opts, ist->st->codec->codec_id, ic, st, ist->dec);
|
||||
|
||||
ist->reinit_filters = -1;
|
||||
MATCH_PER_STREAM_OPT(reinit_filters, i, ist->reinit_filters, ic, st);
|
||||
|
||||
MATCH_PER_STREAM_OPT(discard, str, discard_str, ic, st);
|
||||
ist->user_set_discard = AVDISCARD_NONE;
|
||||
if (discard_str && av_opt_eval_int(&cc, discard_opt, discard_str, &ist->user_set_discard) < 0) {
|
||||
if (discard_str && av_opt_eval_int(dec, discard_opt, discard_str, &ist->user_set_discard) < 0) {
|
||||
av_log(NULL, AV_LOG_ERROR, "Error parsing discard %s.\n",
|
||||
discard_str);
|
||||
exit_program(1);
|
||||
@@ -709,30 +689,22 @@ static void add_input_streams(OptionsContext *o, AVFormatContext *ic)
|
||||
exit_program(1);
|
||||
}
|
||||
|
||||
ret = avcodec_parameters_to_context(ist->dec_ctx, par);
|
||||
ret = avcodec_copy_context(ist->dec_ctx, dec);
|
||||
if (ret < 0) {
|
||||
av_log(NULL, AV_LOG_ERROR, "Error initializing the decoder context.\n");
|
||||
exit_program(1);
|
||||
}
|
||||
|
||||
switch (par->codec_type) {
|
||||
switch (dec->codec_type) {
|
||||
case AVMEDIA_TYPE_VIDEO:
|
||||
if(!ist->dec)
|
||||
ist->dec = avcodec_find_decoder(par->codec_id);
|
||||
ist->dec = avcodec_find_decoder(dec->codec_id);
|
||||
#if FF_API_EMU_EDGE
|
||||
if (av_codec_get_lowres(st->codec)) {
|
||||
av_codec_set_lowres(ist->dec_ctx, av_codec_get_lowres(st->codec));
|
||||
ist->dec_ctx->width = st->codec->width;
|
||||
ist->dec_ctx->height = st->codec->height;
|
||||
ist->dec_ctx->coded_width = st->codec->coded_width;
|
||||
ist->dec_ctx->coded_height = st->codec->coded_height;
|
||||
ist->dec_ctx->flags |= CODEC_FLAG_EMU_EDGE;
|
||||
if (av_codec_get_lowres(dec)) {
|
||||
dec->flags |= CODEC_FLAG_EMU_EDGE;
|
||||
}
|
||||
#endif
|
||||
|
||||
// avformat_find_stream_info() doesn't set this for us anymore.
|
||||
ist->dec_ctx->framerate = st->avg_frame_rate;
|
||||
|
||||
ist->resample_height = ist->dec_ctx->height;
|
||||
ist->resample_width = ist->dec_ctx->width;
|
||||
ist->resample_pix_fmt = ist->dec_ctx->pix_fmt;
|
||||
@@ -781,19 +753,6 @@ static void add_input_streams(OptionsContext *o, AVFormatContext *ic)
|
||||
if (!ist->hwaccel_device)
|
||||
exit_program(1);
|
||||
}
|
||||
|
||||
MATCH_PER_STREAM_OPT(hwaccel_output_formats, str,
|
||||
hwaccel_output_format, ic, st);
|
||||
if (hwaccel_output_format) {
|
||||
ist->hwaccel_output_format = av_get_pix_fmt(hwaccel_output_format);
|
||||
if (ist->hwaccel_output_format == AV_PIX_FMT_NONE) {
|
||||
av_log(NULL, AV_LOG_FATAL, "Unrecognised hwaccel output "
|
||||
"format: %s", hwaccel_output_format);
|
||||
}
|
||||
} else {
|
||||
ist->hwaccel_output_format = AV_PIX_FMT_NONE;
|
||||
}
|
||||
|
||||
ist->hwaccel_pix_fmt = AV_PIX_FMT_NONE;
|
||||
|
||||
break;
|
||||
@@ -812,7 +771,7 @@ static void add_input_streams(OptionsContext *o, AVFormatContext *ic)
|
||||
case AVMEDIA_TYPE_SUBTITLE: {
|
||||
char *canvas_size = NULL;
|
||||
if(!ist->dec)
|
||||
ist->dec = avcodec_find_decoder(par->codec_id);
|
||||
ist->dec = avcodec_find_decoder(dec->codec_id);
|
||||
MATCH_PER_STREAM_OPT(fix_sub_duration, i, ist->fix_sub_duration, ic, st);
|
||||
MATCH_PER_STREAM_OPT(canvas_sizes, str, canvas_size, ic, st);
|
||||
if (canvas_size &&
|
||||
@@ -828,12 +787,6 @@ static void add_input_streams(OptionsContext *o, AVFormatContext *ic)
|
||||
default:
|
||||
abort();
|
||||
}
|
||||
|
||||
ret = avcodec_parameters_from_context(par, ist->dec_ctx);
|
||||
if (ret < 0) {
|
||||
av_log(NULL, AV_LOG_ERROR, "Error initializing the decoder context.\n");
|
||||
exit_program(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -872,7 +825,7 @@ static void dump_attachment(AVStream *st, const char *filename)
|
||||
AVIOContext *out = NULL;
|
||||
AVDictionaryEntry *e;
|
||||
|
||||
if (!st->codecpar->extradata_size) {
|
||||
if (!st->codec->extradata_size) {
|
||||
av_log(NULL, AV_LOG_WARNING, "No extradata to dump in stream #%d:%d.\n",
|
||||
nb_input_files - 1, st->index);
|
||||
return;
|
||||
@@ -893,7 +846,7 @@ static void dump_attachment(AVStream *st, const char *filename)
|
||||
exit_program(1);
|
||||
}
|
||||
|
||||
avio_write(out, st->codecpar->extradata, st->codecpar->extradata_size);
|
||||
avio_write(out, st->codec->extradata, st->codec->extradata_size);
|
||||
avio_flush(out);
|
||||
avio_close(out);
|
||||
}
|
||||
@@ -997,8 +950,6 @@ static int open_input_file(OptionsContext *o, const char *filename)
|
||||
err = avformat_open_input(&ic, filename, file_iformat, &o->g->format_opts);
|
||||
if (err < 0) {
|
||||
print_error(filename, err);
|
||||
if (err == AVERROR_PROTOCOL_NOT_FOUND)
|
||||
av_log(NULL, AV_LOG_ERROR, "Did you mean file:%s?\n", filename);
|
||||
exit_program(1);
|
||||
}
|
||||
if (scan_all_pmts_set)
|
||||
@@ -1043,8 +994,8 @@ static int open_input_file(OptionsContext *o, const char *filename)
|
||||
if (!(ic->iformat->flags & AVFMT_SEEK_TO_PTS)) {
|
||||
int dts_heuristic = 0;
|
||||
for (i=0; i<ic->nb_streams; i++) {
|
||||
const AVCodecParameters *par = ic->streams[i]->codecpar;
|
||||
if (par->video_delay)
|
||||
AVCodecContext *avctx = ic->streams[i]->codec;
|
||||
if (avctx->has_b_frames)
|
||||
dts_heuristic = 1;
|
||||
}
|
||||
if (dts_heuristic) {
|
||||
@@ -1189,39 +1140,21 @@ static int get_preset_file_2(const char *preset_name, const char *codec_name, AV
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int choose_encoder(OptionsContext *o, AVFormatContext *s, OutputStream *ost)
|
||||
static void choose_encoder(OptionsContext *o, AVFormatContext *s, OutputStream *ost)
|
||||
{
|
||||
enum AVMediaType type = ost->st->codecpar->codec_type;
|
||||
char *codec_name = NULL;
|
||||
|
||||
if (type == AVMEDIA_TYPE_VIDEO || type == AVMEDIA_TYPE_AUDIO || type == AVMEDIA_TYPE_SUBTITLE) {
|
||||
MATCH_PER_STREAM_OPT(codec_names, str, codec_name, s, ost->st);
|
||||
if (!codec_name) {
|
||||
ost->st->codecpar->codec_id = av_guess_codec(s->oformat, NULL, s->filename,
|
||||
NULL, ost->st->codecpar->codec_type);
|
||||
ost->enc = avcodec_find_encoder(ost->st->codecpar->codec_id);
|
||||
if (!ost->enc) {
|
||||
av_log(NULL, AV_LOG_FATAL, "Automatic encoder selection failed for "
|
||||
"output stream #%d:%d. Default encoder for format %s (codec %s) is "
|
||||
"probably disabled. Please choose an encoder manually.\n",
|
||||
ost->file_index, ost->index, s->oformat->name,
|
||||
avcodec_get_name(ost->st->codecpar->codec_id));
|
||||
return AVERROR_ENCODER_NOT_FOUND;
|
||||
}
|
||||
} else if (!strcmp(codec_name, "copy"))
|
||||
ost->stream_copy = 1;
|
||||
else {
|
||||
ost->enc = find_codec_or_die(codec_name, ost->st->codecpar->codec_type, 1);
|
||||
ost->st->codecpar->codec_id = ost->enc->id;
|
||||
}
|
||||
ost->encoding_needed = !ost->stream_copy;
|
||||
} else {
|
||||
/* no encoding supported for other media types */
|
||||
ost->stream_copy = 1;
|
||||
ost->encoding_needed = 0;
|
||||
MATCH_PER_STREAM_OPT(codec_names, str, codec_name, s, ost->st);
|
||||
if (!codec_name) {
|
||||
ost->st->codec->codec_id = av_guess_codec(s->oformat, NULL, s->filename,
|
||||
NULL, ost->st->codec->codec_type);
|
||||
ost->enc = avcodec_find_encoder(ost->st->codec->codec_id);
|
||||
} else if (!strcmp(codec_name, "copy"))
|
||||
ost->stream_copy = 1;
|
||||
else {
|
||||
ost->enc = find_codec_or_die(codec_name, ost->st->codec->codec_type, 1);
|
||||
ost->st->codec->codec_id = ost->enc->id;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static OutputStream *new_output_stream(OptionsContext *o, AVFormatContext *oc, enum AVMediaType type, int source_index)
|
||||
@@ -1229,8 +1162,8 @@ static OutputStream *new_output_stream(OptionsContext *o, AVFormatContext *oc, e
|
||||
OutputStream *ost;
|
||||
AVStream *st = avformat_new_stream(oc, NULL);
|
||||
int idx = oc->nb_streams - 1, ret = 0;
|
||||
const char *bsfs = NULL;
|
||||
char *next, *codec_tag = NULL;
|
||||
char *bsf = NULL, *next, *codec_tag = NULL;
|
||||
AVBitStreamFilterContext *bsfc, *bsfc_prev = NULL;
|
||||
double qscale = -1;
|
||||
int i;
|
||||
|
||||
@@ -1250,14 +1183,8 @@ static OutputStream *new_output_stream(OptionsContext *o, AVFormatContext *oc, e
|
||||
ost->file_index = nb_output_files - 1;
|
||||
ost->index = idx;
|
||||
ost->st = st;
|
||||
st->codecpar->codec_type = type;
|
||||
|
||||
ret = choose_encoder(o, oc, ost);
|
||||
if (ret < 0) {
|
||||
av_log(NULL, AV_LOG_FATAL, "Error selecting an encoder for stream "
|
||||
"%d:%d\n", ost->file_index, ost->index);
|
||||
exit_program(1);
|
||||
}
|
||||
st->codec->codec_type = type;
|
||||
choose_encoder(o, oc, ost);
|
||||
|
||||
ost->enc_ctx = avcodec_alloc_context3(ost->enc);
|
||||
if (!ost->enc_ctx) {
|
||||
@@ -1266,12 +1193,6 @@ static OutputStream *new_output_stream(OptionsContext *o, AVFormatContext *oc, e
|
||||
}
|
||||
ost->enc_ctx->codec_type = type;
|
||||
|
||||
ost->ref_par = avcodec_parameters_alloc();
|
||||
if (!ost->ref_par) {
|
||||
av_log(NULL, AV_LOG_ERROR, "Error allocating the encoding parameters.\n");
|
||||
exit_program(1);
|
||||
}
|
||||
|
||||
if (ost->enc) {
|
||||
AVIOContext *s = NULL;
|
||||
char *buf = NULL, *arg = NULL, *preset = NULL;
|
||||
@@ -1319,62 +1240,29 @@ static OutputStream *new_output_stream(OptionsContext *o, AVFormatContext *oc, e
|
||||
ost->copy_prior_start = -1;
|
||||
MATCH_PER_STREAM_OPT(copy_prior_start, i, ost->copy_prior_start, oc ,st);
|
||||
|
||||
MATCH_PER_STREAM_OPT(bitstream_filters, str, bsfs, oc, st);
|
||||
while (bsfs && *bsfs) {
|
||||
const AVBitStreamFilter *filter;
|
||||
char *bsf, *bsf_options_str, *bsf_name;
|
||||
|
||||
bsf = av_get_token(&bsfs, ",");
|
||||
if (!bsf)
|
||||
exit_program(1);
|
||||
bsf_name = av_strtok(bsf, "=", &bsf_options_str);
|
||||
if (!bsf_name)
|
||||
exit_program(1);
|
||||
|
||||
filter = av_bsf_get_by_name(bsf_name);
|
||||
if (!filter) {
|
||||
av_log(NULL, AV_LOG_FATAL, "Unknown bitstream filter %s\n", bsf_name);
|
||||
MATCH_PER_STREAM_OPT(bitstream_filters, str, bsf, oc, st);
|
||||
while (bsf) {
|
||||
char *arg = NULL;
|
||||
if (next = strchr(bsf, ','))
|
||||
*next++ = 0;
|
||||
if (arg = strchr(bsf, '='))
|
||||
*arg++ = 0;
|
||||
if (!(bsfc = av_bitstream_filter_init(bsf))) {
|
||||
av_log(NULL, AV_LOG_FATAL, "Unknown bitstream filter %s\n", bsf);
|
||||
exit_program(1);
|
||||
}
|
||||
|
||||
ost->bsf_ctx = av_realloc_array(ost->bsf_ctx,
|
||||
ost->nb_bitstream_filters + 1,
|
||||
sizeof(*ost->bsf_ctx));
|
||||
if (!ost->bsf_ctx)
|
||||
exit_program(1);
|
||||
|
||||
ret = av_bsf_alloc(filter, &ost->bsf_ctx[ost->nb_bitstream_filters]);
|
||||
if (ret < 0) {
|
||||
av_log(NULL, AV_LOG_ERROR, "Error allocating a bitstream filter context\n");
|
||||
exit_program(1);
|
||||
}
|
||||
|
||||
ost->nb_bitstream_filters++;
|
||||
|
||||
if (bsf_options_str && filter->priv_class) {
|
||||
const AVOption *opt = av_opt_next(ost->bsf_ctx[ost->nb_bitstream_filters-1]->priv_data, NULL);
|
||||
const char * shorthand[2] = {NULL};
|
||||
|
||||
if (opt)
|
||||
shorthand[0] = opt->name;
|
||||
|
||||
ret = av_opt_set_from_string(ost->bsf_ctx[ost->nb_bitstream_filters-1]->priv_data, bsf_options_str, shorthand, "=", ":");
|
||||
if (ret < 0) {
|
||||
av_log(NULL, AV_LOG_ERROR, "Error parsing options for bitstream filter %s\n", bsf_name);
|
||||
if (bsfc_prev)
|
||||
bsfc_prev->next = bsfc;
|
||||
else
|
||||
ost->bitstream_filters = bsfc;
|
||||
if (arg)
|
||||
if (!(bsfc->args = av_strdup(arg))) {
|
||||
av_log(NULL, AV_LOG_FATAL, "Bitstream filter memory allocation failed\n");
|
||||
exit_program(1);
|
||||
}
|
||||
}
|
||||
av_freep(&bsf);
|
||||
|
||||
if (*bsfs)
|
||||
bsfs++;
|
||||
}
|
||||
if (ost->nb_bitstream_filters) {
|
||||
ost->bsf_extradata_updated = av_mallocz_array(ost->nb_bitstream_filters, sizeof(*ost->bsf_extradata_updated));
|
||||
if (!ost->bsf_extradata_updated) {
|
||||
av_log(NULL, AV_LOG_FATAL, "Bitstream filter memory allocation failed\n");
|
||||
exit_program(1);
|
||||
}
|
||||
bsfc_prev = bsfc;
|
||||
bsf = next;
|
||||
}
|
||||
|
||||
MATCH_PER_STREAM_OPT(codec_tags, str, codec_tag, oc, st);
|
||||
@@ -1382,7 +1270,7 @@ static OutputStream *new_output_stream(OptionsContext *o, AVFormatContext *oc, e
|
||||
uint32_t tag = strtol(codec_tag, &next, 0);
|
||||
if (*next)
|
||||
tag = AV_RL32(codec_tag);
|
||||
ost->st->codecpar->codec_tag =
|
||||
ost->st->codec->codec_tag =
|
||||
ost->enc_ctx->codec_tag = tag;
|
||||
}
|
||||
|
||||
@@ -1395,10 +1283,6 @@ static OutputStream *new_output_stream(OptionsContext *o, AVFormatContext *oc, e
|
||||
MATCH_PER_STREAM_OPT(disposition, str, ost->disposition, oc, st);
|
||||
ost->disposition = av_strdup(ost->disposition);
|
||||
|
||||
ost->max_muxing_queue_size = 128;
|
||||
MATCH_PER_STREAM_OPT(max_muxing_queue_size, i, ost->max_muxing_queue_size, oc, st);
|
||||
ost->max_muxing_queue_size *= sizeof(AVPacket);
|
||||
|
||||
if (oc->oformat->flags & AVFMT_GLOBALHEADER)
|
||||
ost->enc_ctx->flags |= AV_CODEC_FLAG_GLOBAL_HEADER;
|
||||
|
||||
@@ -1418,10 +1302,6 @@ static OutputStream *new_output_stream(OptionsContext *o, AVFormatContext *oc, e
|
||||
}
|
||||
ost->last_mux_dts = AV_NOPTS_VALUE;
|
||||
|
||||
ost->muxing_queue = av_fifo_alloc(8 * sizeof(AVPacket));
|
||||
if (!ost->muxing_queue)
|
||||
exit_program(1);
|
||||
|
||||
return ost;
|
||||
}
|
||||
|
||||
@@ -1487,7 +1367,7 @@ static char *get_ost_filters(OptionsContext *o, AVFormatContext *oc,
|
||||
else if (ost->filters)
|
||||
return av_strdup(ost->filters);
|
||||
|
||||
return av_strdup(st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO ?
|
||||
return av_strdup(st->codec->codec_type == AVMEDIA_TYPE_VIDEO ?
|
||||
"null" : "anull");
|
||||
}
|
||||
|
||||
@@ -1919,9 +1799,9 @@ static int read_ffserver_streams(OptionsContext *o, AVFormatContext *s, const ch
|
||||
AVCodec *codec;
|
||||
const char *enc_config;
|
||||
|
||||
codec = avcodec_find_encoder(ic->streams[i]->codecpar->codec_id);
|
||||
codec = avcodec_find_encoder(ic->streams[i]->codec->codec_id);
|
||||
if (!codec) {
|
||||
av_log(s, AV_LOG_ERROR, "no encoder found for codec id %i\n", ic->streams[i]->codecpar->codec_id);
|
||||
av_log(s, AV_LOG_ERROR, "no encoder found for codec id %i\n", ic->streams[i]->codec->codec_id);
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
if (codec->type == AVMEDIA_TYPE_AUDIO)
|
||||
@@ -1940,10 +1820,10 @@ static int read_ffserver_streams(OptionsContext *o, AVFormatContext *s, const ch
|
||||
av_dict_free(&opts);
|
||||
}
|
||||
|
||||
if (st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO && !ost->stream_copy)
|
||||
if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO && !ost->stream_copy)
|
||||
choose_sample_fmt(st, codec);
|
||||
else if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO && !ost->stream_copy)
|
||||
choose_pixel_fmt(st, st->codec, codec, st->codecpar->format);
|
||||
else if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO && !ost->stream_copy)
|
||||
choose_pixel_fmt(st, st->codec, codec, st->codec->pix_fmt);
|
||||
avcodec_copy_context(ost->enc_ctx, st->codec);
|
||||
if (enc_config)
|
||||
av_dict_parse_string(&ost->encoder_opts, enc_config, "=", ",", 0);
|
||||
@@ -2011,7 +1891,7 @@ static int configure_complex_filters(void)
|
||||
int i, ret = 0;
|
||||
|
||||
for (i = 0; i < nb_filtergraphs; i++)
|
||||
if (!filtergraph_is_simple(filtergraphs[i]) &&
|
||||
if (!filtergraphs[i]->graph &&
|
||||
(ret = configure_filtergraph(filtergraphs[i])) < 0)
|
||||
return ret;
|
||||
return 0;
|
||||
@@ -2115,18 +1995,18 @@ static int open_output_file(OptionsContext *o, const char *filename)
|
||||
ost = output_streams[j];
|
||||
for (i = 0; i < nb_input_streams; i++) {
|
||||
ist = input_streams[i];
|
||||
if(ist->st->codecpar->codec_type == ost->st->codecpar->codec_type){
|
||||
if(ist->st->codec->codec_type == ost->st->codec->codec_type){
|
||||
ost->sync_ist= ist;
|
||||
ost->source_index= i;
|
||||
if(ost->st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO) ost->avfilter = av_strdup("anull");
|
||||
if(ost->st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) ost->avfilter = av_strdup("null");
|
||||
if(ost->st->codec->codec_type == AVMEDIA_TYPE_AUDIO) ost->avfilter = av_strdup("anull");
|
||||
if(ost->st->codec->codec_type == AVMEDIA_TYPE_VIDEO) ost->avfilter = av_strdup("null");
|
||||
ist->discard = 0;
|
||||
ist->st->discard = ist->user_set_discard;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!ost->sync_ist){
|
||||
av_log(NULL, AV_LOG_FATAL, "Missing %s stream which is required by this ffm\n", av_get_media_type_string(ost->st->codecpar->codec_type));
|
||||
av_log(NULL, AV_LOG_FATAL, "Missing %s stream which is required by this ffm\n", av_get_media_type_string(ost->st->codec->codec_type));
|
||||
exit_program(1);
|
||||
}
|
||||
}
|
||||
@@ -2141,10 +2021,10 @@ static int open_output_file(OptionsContext *o, const char *filename)
|
||||
for (i = 0; i < nb_input_streams; i++) {
|
||||
int new_area;
|
||||
ist = input_streams[i];
|
||||
new_area = ist->st->codecpar->width * ist->st->codecpar->height + 100000000*!!ist->st->codec_info_nb_frames;
|
||||
new_area = ist->st->codec->width * ist->st->codec->height + 100000000*!!ist->st->codec_info_nb_frames;
|
||||
if((qcr!=MKTAG('A', 'P', 'I', 'C')) && (ist->st->disposition & AV_DISPOSITION_ATTACHED_PIC))
|
||||
new_area = 1;
|
||||
if (ist->st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO &&
|
||||
if (ist->st->codec->codec_type == AVMEDIA_TYPE_VIDEO &&
|
||||
new_area > area) {
|
||||
if((qcr==MKTAG('A', 'P', 'I', 'C')) && !(ist->st->disposition & AV_DISPOSITION_ATTACHED_PIC))
|
||||
continue;
|
||||
@@ -2162,8 +2042,8 @@ static int open_output_file(OptionsContext *o, const char *filename)
|
||||
for (i = 0; i < nb_input_streams; i++) {
|
||||
int score;
|
||||
ist = input_streams[i];
|
||||
score = ist->st->codecpar->channels + 100000000*!!ist->st->codec_info_nb_frames;
|
||||
if (ist->st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO &&
|
||||
score = ist->st->codec->channels + 100000000*!!ist->st->codec_info_nb_frames;
|
||||
if (ist->st->codec->codec_type == AVMEDIA_TYPE_AUDIO &&
|
||||
score > best_score) {
|
||||
best_score = score;
|
||||
idx = i;
|
||||
@@ -2177,9 +2057,9 @@ static int open_output_file(OptionsContext *o, const char *filename)
|
||||
MATCH_PER_TYPE_OPT(codec_names, str, subtitle_codec_name, oc, "s");
|
||||
if (!o->subtitle_disable && (avcodec_find_encoder(oc->oformat->subtitle_codec) || subtitle_codec_name)) {
|
||||
for (i = 0; i < nb_input_streams; i++)
|
||||
if (input_streams[i]->st->codecpar->codec_type == AVMEDIA_TYPE_SUBTITLE) {
|
||||
if (input_streams[i]->st->codec->codec_type == AVMEDIA_TYPE_SUBTITLE) {
|
||||
AVCodecDescriptor const *input_descriptor =
|
||||
avcodec_descriptor_get(input_streams[i]->st->codecpar->codec_id);
|
||||
avcodec_descriptor_get(input_streams[i]->st->codec->codec_id);
|
||||
AVCodecDescriptor const *output_descriptor = NULL;
|
||||
AVCodec const *output_codec =
|
||||
avcodec_find_encoder(oc->oformat->subtitle_codec);
|
||||
@@ -2205,8 +2085,8 @@ static int open_output_file(OptionsContext *o, const char *filename)
|
||||
if (!o->data_disable ) {
|
||||
enum AVCodecID codec_id = av_guess_codec(oc->oformat, NULL, filename, NULL, AVMEDIA_TYPE_DATA);
|
||||
for (i = 0; codec_id != AV_CODEC_ID_NONE && i < nb_input_streams; i++) {
|
||||
if (input_streams[i]->st->codecpar->codec_type == AVMEDIA_TYPE_DATA
|
||||
&& input_streams[i]->st->codecpar->codec_id == codec_id )
|
||||
if (input_streams[i]->st->codec->codec_type == AVMEDIA_TYPE_DATA
|
||||
&& input_streams[i]->st->codec->codec_id == codec_id )
|
||||
new_data_stream(o, oc, i);
|
||||
}
|
||||
}
|
||||
@@ -2243,17 +2123,17 @@ loop_end:
|
||||
int src_idx = input_files[map->file_index]->ist_index + map->stream_index;
|
||||
|
||||
ist = input_streams[input_files[map->file_index]->ist_index + map->stream_index];
|
||||
if(o->subtitle_disable && ist->st->codecpar->codec_type == AVMEDIA_TYPE_SUBTITLE)
|
||||
if(o->subtitle_disable && ist->st->codec->codec_type == AVMEDIA_TYPE_SUBTITLE)
|
||||
continue;
|
||||
if(o-> audio_disable && ist->st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO)
|
||||
if(o-> audio_disable && ist->st->codec->codec_type == AVMEDIA_TYPE_AUDIO)
|
||||
continue;
|
||||
if(o-> video_disable && ist->st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO)
|
||||
if(o-> video_disable && ist->st->codec->codec_type == AVMEDIA_TYPE_VIDEO)
|
||||
continue;
|
||||
if(o-> data_disable && ist->st->codecpar->codec_type == AVMEDIA_TYPE_DATA)
|
||||
if(o-> data_disable && ist->st->codec->codec_type == AVMEDIA_TYPE_DATA)
|
||||
continue;
|
||||
|
||||
ost = NULL;
|
||||
switch (ist->st->codecpar->codec_type) {
|
||||
switch (ist->st->codec->codec_type) {
|
||||
case AVMEDIA_TYPE_VIDEO: ost = new_video_stream (o, oc, src_idx); break;
|
||||
case AVMEDIA_TYPE_AUDIO: ost = new_audio_stream (o, oc, src_idx); break;
|
||||
case AVMEDIA_TYPE_SUBTITLE: ost = new_subtitle_stream (o, oc, src_idx); break;
|
||||
@@ -2308,17 +2188,17 @@ loop_end:
|
||||
avio_read(pb, attachment, len);
|
||||
|
||||
ost = new_attachment_stream(o, oc, -1);
|
||||
ost->stream_copy = 0;
|
||||
ost->stream_copy = 1;
|
||||
ost->attachment_filename = o->attachments[i];
|
||||
ost->st->codecpar->extradata = attachment;
|
||||
ost->st->codecpar->extradata_size = len;
|
||||
ost->finished = 1;
|
||||
ost->st->codec->extradata = attachment;
|
||||
ost->st->codec->extradata_size = len;
|
||||
|
||||
p = strrchr(o->attachments[i], '/');
|
||||
av_dict_set(&ost->st->metadata, "filename", (p && *p) ? p + 1 : o->attachments[i], AV_DICT_DONT_OVERWRITE);
|
||||
avio_closep(&pb);
|
||||
}
|
||||
|
||||
#if FF_API_LAVF_AVCTX
|
||||
for (i = nb_output_streams - oc->nb_streams; i < nb_output_streams; i++) { //for all streams of this output file
|
||||
AVDictionaryEntry *e;
|
||||
ost = output_streams[i];
|
||||
@@ -2329,7 +2209,6 @@ loop_end:
|
||||
if (av_opt_set(ost->st->codec, "flags", e->value, 0) < 0)
|
||||
exit_program(1);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!oc->nb_streams && !(oc->oformat->flags & AVFMT_NOSTREAMS)) {
|
||||
av_dump_format(oc, nb_output_files - 1, oc->filename, 1);
|
||||
@@ -2379,25 +2258,14 @@ loop_end:
|
||||
}
|
||||
av_dict_free(&unused_opts);
|
||||
|
||||
/* set the decoding_needed flags and create simple filtergraphs */
|
||||
/* set the encoding/decoding_needed flags */
|
||||
for (i = of->ost_index; i < nb_output_streams; i++) {
|
||||
OutputStream *ost = output_streams[i];
|
||||
|
||||
ost->encoding_needed = !ost->stream_copy;
|
||||
if (ost->encoding_needed && ost->source_index >= 0) {
|
||||
InputStream *ist = input_streams[ost->source_index];
|
||||
ist->decoding_needed |= DECODING_FOR_OST;
|
||||
|
||||
if (ost->st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO ||
|
||||
ost->st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO) {
|
||||
err = init_simple_filtergraph(ist, ost);
|
||||
if (err < 0) {
|
||||
av_log(NULL, AV_LOG_ERROR,
|
||||
"Error initializing a simple filtergraph between streams "
|
||||
"%d:%d->%d:%d\n", ist->file_index, ost->source_index,
|
||||
nb_output_files - 1, ost->st->index);
|
||||
exit_program(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2562,6 +2430,7 @@ loop_end:
|
||||
char type, *val;
|
||||
const char *stream_spec;
|
||||
int index = 0, j, ret = 0;
|
||||
char now_time[256];
|
||||
|
||||
val = strchr(o->metadata[i].u.str, '=');
|
||||
if (!val) {
|
||||
@@ -2571,6 +2440,17 @@ loop_end:
|
||||
}
|
||||
*val++ = 0;
|
||||
|
||||
if (!strcmp(o->metadata[i].u.str, "creation_time") &&
|
||||
!strcmp(val, "now")) {
|
||||
time_t now = time(0);
|
||||
struct tm *ptm, tmbuf;
|
||||
ptm = localtime_r(&now, &tmbuf);
|
||||
if (ptm) {
|
||||
if (strftime(now_time, sizeof(now_time), "%Y-%m-%d %H:%M:%S", ptm))
|
||||
val = now_time;
|
||||
}
|
||||
}
|
||||
|
||||
parse_meta_type(o->metadata[i].specifier, &type, &index, &stream_spec);
|
||||
if (type == 's') {
|
||||
for (j = 0; j < oc->nb_streams; j++) {
|
||||
@@ -2635,10 +2515,11 @@ static int opt_target(void *optctx, const char *opt, const char *arg)
|
||||
int i, j, fr;
|
||||
for (j = 0; j < nb_input_files; j++) {
|
||||
for (i = 0; i < input_files[j]->nb_streams; i++) {
|
||||
AVStream *st = input_files[j]->ctx->streams[i];
|
||||
if (st->codecpar->codec_type != AVMEDIA_TYPE_VIDEO)
|
||||
AVCodecContext *c = input_files[j]->ctx->streams[i]->codec;
|
||||
if (c->codec_type != AVMEDIA_TYPE_VIDEO ||
|
||||
!c->time_base.num)
|
||||
continue;
|
||||
fr = st->time_base.den * 1000 / st->time_base.num;
|
||||
fr = c->time_base.den * 1000 / c->time_base.num;
|
||||
if (fr == 25000) {
|
||||
norm = PAL;
|
||||
break;
|
||||
@@ -3168,9 +3049,6 @@ int ffmpeg_parse_options(int argc, char **argv)
|
||||
goto fail;
|
||||
}
|
||||
|
||||
/* configure terminal and setup signal handlers */
|
||||
term_init();
|
||||
|
||||
/* open input files */
|
||||
ret = open_files(&octx.groups[GROUP_INFILE], "input", open_input_file);
|
||||
if (ret < 0) {
|
||||
@@ -3483,9 +3361,9 @@ const OptionDef options[] = {
|
||||
{ "hwaccel_device", OPT_VIDEO | OPT_STRING | HAS_ARG | OPT_EXPERT |
|
||||
OPT_SPEC | OPT_INPUT, { .off = OFFSET(hwaccel_devices) },
|
||||
"select a device for HW acceleration", "devicename" },
|
||||
{ "hwaccel_output_format", OPT_VIDEO | OPT_STRING | HAS_ARG | OPT_EXPERT |
|
||||
OPT_SPEC | OPT_INPUT, { .off = OFFSET(hwaccel_output_formats) },
|
||||
"select output format used with HW accelerated decoding", "format" },
|
||||
#if HAVE_VDPAU_X11
|
||||
{ "vdpau_api_ver", HAS_ARG | OPT_INT | OPT_EXPERT, { &vdpau_api_ver }, "" },
|
||||
#endif
|
||||
#if CONFIG_VDA || CONFIG_VIDEOTOOLBOX
|
||||
{ "videotoolbox_pixfmt", HAS_ARG | OPT_STRING | OPT_EXPERT, { &videotoolbox_pixfmt}, "" },
|
||||
#endif
|
||||
@@ -3494,8 +3372,6 @@ const OptionDef options[] = {
|
||||
{ "autorotate", HAS_ARG | OPT_BOOL | OPT_SPEC |
|
||||
OPT_EXPERT | OPT_INPUT, { .off = OFFSET(autorotate) },
|
||||
"automatically insert correct rotate filters" },
|
||||
{ "hwaccel_lax_profile_check", OPT_BOOL | OPT_EXPERT, { &hwaccel_lax_profile_check},
|
||||
"attempt to decode anyway if HW accelerated decoder's supported profiles do not exactly match the stream" },
|
||||
|
||||
/* audio options */
|
||||
{ "aframes", OPT_AUDIO | HAS_ARG | OPT_PERFILE | OPT_OUTPUT, { .func_arg = opt_audio_frames },
|
||||
@@ -3573,20 +3449,11 @@ const OptionDef options[] = {
|
||||
"set the subtitle options to the indicated preset", "preset" },
|
||||
{ "fpre", HAS_ARG | OPT_EXPERT| OPT_PERFILE | OPT_OUTPUT, { .func_arg = opt_preset },
|
||||
"set options from indicated preset file", "filename" },
|
||||
|
||||
{ "max_muxing_queue_size", HAS_ARG | OPT_INT | OPT_SPEC | OPT_EXPERT | OPT_OUTPUT, { .off = OFFSET(max_muxing_queue_size) },
|
||||
"maximum number of packets that can be buffered while waiting for all streams to initialize", "packets" },
|
||||
|
||||
/* data codec support */
|
||||
{ "dcodec", HAS_ARG | OPT_DATA | OPT_PERFILE | OPT_EXPERT | OPT_INPUT | OPT_OUTPUT, { .func_arg = opt_data_codec },
|
||||
"force data codec ('copy' to copy stream)", "codec" },
|
||||
{ "dn", OPT_BOOL | OPT_VIDEO | OPT_OFFSET | OPT_INPUT | OPT_OUTPUT, { .off = OFFSET(data_disable) },
|
||||
"disable data" },
|
||||
|
||||
#if CONFIG_VAAPI
|
||||
{ "vaapi_device", HAS_ARG | OPT_EXPERT, { .func_arg = opt_vaapi_device },
|
||||
"set VAAPI hardware device (DRM path or X11 display name)", "device" },
|
||||
#endif
|
||||
|
||||
{ NULL, },
|
||||
};
|
||||
|
||||
@@ -210,7 +210,8 @@ int qsv_transcode_init(OutputStream *ost)
|
||||
|
||||
/* check if the decoder supports QSV and the output only goes to this stream */
|
||||
ist = input_streams[ost->source_index];
|
||||
if (ist->hwaccel_id != HWACCEL_QSV || !ist->dec || !ist->dec->pix_fmts)
|
||||
if (ist->nb_filters || ist->hwaccel_id != HWACCEL_QSV ||
|
||||
!ist->dec || !ist->dec->pix_fmts)
|
||||
return 0;
|
||||
for (pix_fmt = ist->dec->pix_fmts; *pix_fmt != AV_PIX_FMT_NONE; pix_fmt++)
|
||||
if (*pix_fmt == AV_PIX_FMT_QSV)
|
||||
|
||||
538
ffmpeg_vaapi.c
538
ffmpeg_vaapi.c
@@ -1,538 +0,0 @@
|
||||
/*
|
||||
* 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 "config.h"
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <va/va.h>
|
||||
#if HAVE_VAAPI_X11
|
||||
# include <va/va_x11.h>
|
||||
#endif
|
||||
#if HAVE_VAAPI_DRM
|
||||
# include <va/va_drm.h>
|
||||
#endif
|
||||
|
||||
#include "libavutil/avassert.h"
|
||||
#include "libavutil/avconfig.h"
|
||||
#include "libavutil/buffer.h"
|
||||
#include "libavutil/frame.h"
|
||||
#include "libavutil/hwcontext.h"
|
||||
#include "libavutil/hwcontext_vaapi.h"
|
||||
#include "libavutil/imgutils.h"
|
||||
#include "libavutil/opt.h"
|
||||
#include "libavutil/pixfmt.h"
|
||||
|
||||
#include "libavcodec/vaapi.h"
|
||||
|
||||
#include "ffmpeg.h"
|
||||
|
||||
|
||||
static AVClass vaapi_class = {
|
||||
.class_name = "vaapi",
|
||||
.item_name = av_default_item_name,
|
||||
.version = LIBAVUTIL_VERSION_INT,
|
||||
};
|
||||
|
||||
#define DEFAULT_SURFACES 20
|
||||
|
||||
typedef struct VAAPIDecoderContext {
|
||||
const AVClass *class;
|
||||
|
||||
AVBufferRef *device_ref;
|
||||
AVHWDeviceContext *device;
|
||||
AVBufferRef *frames_ref;
|
||||
AVHWFramesContext *frames;
|
||||
|
||||
VAProfile va_profile;
|
||||
VAEntrypoint va_entrypoint;
|
||||
VAConfigID va_config;
|
||||
VAContextID va_context;
|
||||
|
||||
enum AVPixelFormat decode_format;
|
||||
int decode_width;
|
||||
int decode_height;
|
||||
int decode_surfaces;
|
||||
|
||||
// The output need not have the same format, width and height as the
|
||||
// decoded frames - the copy for non-direct-mapped access is actually
|
||||
// a whole vpp instance which can do arbitrary scaling and format
|
||||
// conversion.
|
||||
enum AVPixelFormat output_format;
|
||||
|
||||
struct vaapi_context decoder_vaapi_context;
|
||||
} VAAPIDecoderContext;
|
||||
|
||||
|
||||
static int vaapi_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
|
||||
{
|
||||
InputStream *ist = avctx->opaque;
|
||||
VAAPIDecoderContext *ctx = ist->hwaccel_ctx;
|
||||
int err;
|
||||
|
||||
err = av_hwframe_get_buffer(ctx->frames_ref, frame, 0);
|
||||
if (err < 0) {
|
||||
av_log(ctx, AV_LOG_ERROR, "Failed to allocate decoder surface.\n");
|
||||
} else {
|
||||
av_log(ctx, AV_LOG_DEBUG, "Decoder given surface %#x.\n",
|
||||
(unsigned int)(uintptr_t)frame->data[3]);
|
||||
}
|
||||
return err;
|
||||
}
|
||||
|
||||
static int vaapi_retrieve_data(AVCodecContext *avctx, AVFrame *input)
|
||||
{
|
||||
InputStream *ist = avctx->opaque;
|
||||
VAAPIDecoderContext *ctx = ist->hwaccel_ctx;
|
||||
AVFrame *output = 0;
|
||||
int err;
|
||||
|
||||
av_assert0(input->format == AV_PIX_FMT_VAAPI);
|
||||
|
||||
if (ctx->output_format == AV_PIX_FMT_VAAPI) {
|
||||
// Nothing to do.
|
||||
return 0;
|
||||
}
|
||||
|
||||
av_log(ctx, AV_LOG_DEBUG, "Retrieve data from surface %#x.\n",
|
||||
(unsigned int)(uintptr_t)input->data[3]);
|
||||
|
||||
output = av_frame_alloc();
|
||||
if (!output)
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
output->format = ctx->output_format;
|
||||
|
||||
err = av_hwframe_transfer_data(output, input, 0);
|
||||
if (err < 0) {
|
||||
av_log(ctx, AV_LOG_ERROR, "Failed to transfer data to "
|
||||
"output frame: %d.\n", err);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
err = av_frame_copy_props(output, input);
|
||||
if (err < 0) {
|
||||
av_frame_unref(output);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
av_frame_unref(input);
|
||||
av_frame_move_ref(input, output);
|
||||
av_frame_free(&output);
|
||||
|
||||
return 0;
|
||||
|
||||
fail:
|
||||
if (output)
|
||||
av_frame_free(&output);
|
||||
return err;
|
||||
}
|
||||
|
||||
|
||||
static const struct {
|
||||
enum AVCodecID codec_id;
|
||||
int codec_profile;
|
||||
VAProfile va_profile;
|
||||
} vaapi_profile_map[] = {
|
||||
#define MAP(c, p, v) { AV_CODEC_ID_ ## c, FF_PROFILE_ ## p, VAProfile ## v }
|
||||
MAP(MPEG2VIDEO, MPEG2_SIMPLE, MPEG2Simple ),
|
||||
MAP(MPEG2VIDEO, MPEG2_MAIN, MPEG2Main ),
|
||||
MAP(H263, UNKNOWN, H263Baseline),
|
||||
MAP(MPEG4, MPEG4_SIMPLE, MPEG4Simple ),
|
||||
MAP(MPEG4, MPEG4_ADVANCED_SIMPLE,
|
||||
MPEG4AdvancedSimple),
|
||||
MAP(MPEG4, MPEG4_MAIN, MPEG4Main ),
|
||||
MAP(H264, H264_CONSTRAINED_BASELINE,
|
||||
H264ConstrainedBaseline),
|
||||
MAP(H264, H264_BASELINE, H264Baseline),
|
||||
MAP(H264, H264_MAIN, H264Main ),
|
||||
MAP(H264, H264_HIGH, H264High ),
|
||||
#if VA_CHECK_VERSION(0, 37, 0)
|
||||
MAP(HEVC, HEVC_MAIN, HEVCMain ),
|
||||
#endif
|
||||
MAP(WMV3, VC1_SIMPLE, VC1Simple ),
|
||||
MAP(WMV3, VC1_MAIN, VC1Main ),
|
||||
MAP(WMV3, VC1_COMPLEX, VC1Advanced ),
|
||||
MAP(WMV3, VC1_ADVANCED, VC1Advanced ),
|
||||
MAP(VC1, VC1_SIMPLE, VC1Simple ),
|
||||
MAP(VC1, VC1_MAIN, VC1Main ),
|
||||
MAP(VC1, VC1_COMPLEX, VC1Advanced ),
|
||||
MAP(VC1, VC1_ADVANCED, VC1Advanced ),
|
||||
#if VA_CHECK_VERSION(0, 35, 0)
|
||||
MAP(VP8, UNKNOWN, VP8Version0_3 ),
|
||||
#endif
|
||||
#if VA_CHECK_VERSION(0, 37, 1)
|
||||
MAP(VP9, VP9_0, VP9Profile0 ),
|
||||
#endif
|
||||
#undef MAP
|
||||
};
|
||||
|
||||
static int vaapi_build_decoder_config(VAAPIDecoderContext *ctx,
|
||||
AVCodecContext *avctx,
|
||||
int fallback_allowed)
|
||||
{
|
||||
AVVAAPIDeviceContext *hwctx = ctx->device->hwctx;
|
||||
AVVAAPIHWConfig *hwconfig = NULL;
|
||||
AVHWFramesConstraints *constraints = NULL;
|
||||
VAStatus vas;
|
||||
int err, i, j;
|
||||
int loglevel = fallback_allowed ? AV_LOG_VERBOSE : AV_LOG_ERROR;
|
||||
const AVCodecDescriptor *codec_desc;
|
||||
const AVPixFmtDescriptor *pix_desc;
|
||||
enum AVPixelFormat pix_fmt;
|
||||
VAProfile profile, *profile_list = NULL;
|
||||
int profile_count, exact_match, alt_profile;
|
||||
|
||||
codec_desc = avcodec_descriptor_get(avctx->codec_id);
|
||||
if (!codec_desc) {
|
||||
err = AVERROR(EINVAL);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
profile_count = vaMaxNumProfiles(hwctx->display);
|
||||
profile_list = av_malloc(profile_count * sizeof(VAProfile));
|
||||
if (!profile_list) {
|
||||
err = AVERROR(ENOMEM);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
vas = vaQueryConfigProfiles(hwctx->display,
|
||||
profile_list, &profile_count);
|
||||
if (vas != VA_STATUS_SUCCESS) {
|
||||
av_log(ctx, loglevel, "Failed to query profiles: %d (%s).\n",
|
||||
vas, vaErrorStr(vas));
|
||||
err = AVERROR(EIO);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
profile = VAProfileNone;
|
||||
exact_match = 0;
|
||||
|
||||
for (i = 0; i < FF_ARRAY_ELEMS(vaapi_profile_map); i++) {
|
||||
int profile_match = 0;
|
||||
if (avctx->codec_id != vaapi_profile_map[i].codec_id)
|
||||
continue;
|
||||
if (avctx->profile == vaapi_profile_map[i].codec_profile)
|
||||
profile_match = 1;
|
||||
profile = vaapi_profile_map[i].va_profile;
|
||||
for (j = 0; j < profile_count; j++) {
|
||||
if (profile == profile_list[j]) {
|
||||
exact_match = profile_match;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (j < profile_count) {
|
||||
if (exact_match)
|
||||
break;
|
||||
alt_profile = vaapi_profile_map[i].codec_profile;
|
||||
}
|
||||
}
|
||||
av_freep(&profile_list);
|
||||
|
||||
if (profile == VAProfileNone) {
|
||||
av_log(ctx, loglevel, "No VAAPI support for codec %s.\n",
|
||||
codec_desc->name);
|
||||
err = AVERROR(ENOSYS);
|
||||
goto fail;
|
||||
}
|
||||
if (!exact_match) {
|
||||
if (fallback_allowed || !hwaccel_lax_profile_check) {
|
||||
av_log(ctx, loglevel, "No VAAPI support for codec %s "
|
||||
"profile %d.\n", codec_desc->name, avctx->profile);
|
||||
if (!fallback_allowed) {
|
||||
av_log(ctx, AV_LOG_WARNING, "If you want attempt decoding "
|
||||
"anyway with a possibly-incompatible profile, add "
|
||||
"the option -hwaccel_lax_profile_check.\n");
|
||||
}
|
||||
err = AVERROR(EINVAL);
|
||||
goto fail;
|
||||
} else {
|
||||
av_log(ctx, AV_LOG_WARNING, "No VAAPI support for codec %s "
|
||||
"profile %d: trying instead with profile %d.\n",
|
||||
codec_desc->name, avctx->profile, alt_profile);
|
||||
av_log(ctx, AV_LOG_WARNING, "This may fail or give "
|
||||
"incorrect results, depending on your hardware.\n");
|
||||
}
|
||||
}
|
||||
|
||||
ctx->va_profile = profile;
|
||||
ctx->va_entrypoint = VAEntrypointVLD;
|
||||
|
||||
vas = vaCreateConfig(hwctx->display, ctx->va_profile,
|
||||
ctx->va_entrypoint, 0, 0, &ctx->va_config);
|
||||
if (vas != VA_STATUS_SUCCESS) {
|
||||
av_log(ctx, AV_LOG_ERROR, "Failed to create decode pipeline "
|
||||
"configuration: %d (%s).\n", vas, vaErrorStr(vas));
|
||||
err = AVERROR(EIO);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
hwconfig = av_hwdevice_hwconfig_alloc(ctx->device_ref);
|
||||
if (!hwconfig) {
|
||||
err = AVERROR(ENOMEM);
|
||||
goto fail;
|
||||
}
|
||||
hwconfig->config_id = ctx->va_config;
|
||||
|
||||
constraints = av_hwdevice_get_hwframe_constraints(ctx->device_ref,
|
||||
hwconfig);
|
||||
if (!constraints)
|
||||
goto fail;
|
||||
|
||||
// Decide on the decoder target format.
|
||||
// If the user specified something with -hwaccel_output_format then
|
||||
// try to use that to minimise conversions later.
|
||||
ctx->decode_format = AV_PIX_FMT_NONE;
|
||||
if (ctx->output_format != AV_PIX_FMT_NONE &&
|
||||
ctx->output_format != AV_PIX_FMT_VAAPI) {
|
||||
for (i = 0; constraints->valid_sw_formats[i] != AV_PIX_FMT_NONE; i++) {
|
||||
if (constraints->valid_sw_formats[i] == ctx->output_format) {
|
||||
ctx->decode_format = ctx->output_format;
|
||||
av_log(ctx, AV_LOG_DEBUG, "Using decode format %s (output "
|
||||
"format).\n", av_get_pix_fmt_name(ctx->decode_format));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Otherwise, we would like to try to choose something which matches the
|
||||
// decoder output, but there isn't enough information available here to
|
||||
// do so. Assume for now that we are always dealing with YUV 4:2:0, so
|
||||
// pick a format which does that.
|
||||
if (ctx->decode_format == AV_PIX_FMT_NONE) {
|
||||
for (i = 0; constraints->valid_sw_formats[i] != AV_PIX_FMT_NONE; i++) {
|
||||
pix_fmt = constraints->valid_sw_formats[i];
|
||||
pix_desc = av_pix_fmt_desc_get(pix_fmt);
|
||||
if (pix_desc->nb_components == 3 &&
|
||||
pix_desc->log2_chroma_w == 1 &&
|
||||
pix_desc->log2_chroma_h == 1) {
|
||||
ctx->decode_format = pix_fmt;
|
||||
av_log(ctx, AV_LOG_DEBUG, "Using decode format %s (format "
|
||||
"matched).\n", av_get_pix_fmt_name(ctx->decode_format));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Otherwise pick the first in the list and hope for the best.
|
||||
if (ctx->decode_format == AV_PIX_FMT_NONE) {
|
||||
ctx->decode_format = constraints->valid_sw_formats[0];
|
||||
av_log(ctx, AV_LOG_DEBUG, "Using decode format %s (first in list).\n",
|
||||
av_get_pix_fmt_name(ctx->decode_format));
|
||||
if (i > 1) {
|
||||
// There was a choice, and we picked randomly. Warn the user
|
||||
// that they might want to choose intelligently instead.
|
||||
av_log(ctx, AV_LOG_WARNING, "Using randomly chosen decode "
|
||||
"format %s.\n", av_get_pix_fmt_name(ctx->decode_format));
|
||||
}
|
||||
}
|
||||
|
||||
// Ensure the picture size is supported by the hardware.
|
||||
ctx->decode_width = avctx->coded_width;
|
||||
ctx->decode_height = avctx->coded_height;
|
||||
if (ctx->decode_width < constraints->min_width ||
|
||||
ctx->decode_height < constraints->min_height ||
|
||||
ctx->decode_width > constraints->max_width ||
|
||||
ctx->decode_height >constraints->max_height) {
|
||||
av_log(ctx, AV_LOG_ERROR, "VAAPI hardware does not support image "
|
||||
"size %dx%d (constraints: width %d-%d height %d-%d).\n",
|
||||
ctx->decode_width, ctx->decode_height,
|
||||
constraints->min_width, constraints->max_width,
|
||||
constraints->min_height, constraints->max_height);
|
||||
err = AVERROR(EINVAL);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
av_hwframe_constraints_free(&constraints);
|
||||
av_freep(&hwconfig);
|
||||
|
||||
// Decide how many reference frames we need. This might be doable more
|
||||
// nicely based on the codec and input stream?
|
||||
ctx->decode_surfaces = DEFAULT_SURFACES;
|
||||
// For frame-threaded decoding, one additional surfaces is needed for
|
||||
// each thread.
|
||||
if (avctx->active_thread_type & FF_THREAD_FRAME)
|
||||
ctx->decode_surfaces += avctx->thread_count;
|
||||
|
||||
return 0;
|
||||
|
||||
fail:
|
||||
av_hwframe_constraints_free(&constraints);
|
||||
av_freep(&hwconfig);
|
||||
vaDestroyConfig(hwctx->display, ctx->va_config);
|
||||
av_freep(&profile_list);
|
||||
return err;
|
||||
}
|
||||
|
||||
static void vaapi_decode_uninit(AVCodecContext *avctx)
|
||||
{
|
||||
InputStream *ist = avctx->opaque;
|
||||
VAAPIDecoderContext *ctx = ist->hwaccel_ctx;
|
||||
|
||||
if (ctx) {
|
||||
AVVAAPIDeviceContext *hwctx = ctx->device->hwctx;
|
||||
|
||||
if (ctx->va_context != VA_INVALID_ID) {
|
||||
vaDestroyContext(hwctx->display, ctx->va_context);
|
||||
ctx->va_context = VA_INVALID_ID;
|
||||
}
|
||||
if (ctx->va_config != VA_INVALID_ID) {
|
||||
vaDestroyConfig(hwctx->display, ctx->va_config);
|
||||
ctx->va_config = VA_INVALID_ID;
|
||||
}
|
||||
|
||||
av_buffer_unref(&ctx->frames_ref);
|
||||
av_buffer_unref(&ctx->device_ref);
|
||||
av_free(ctx);
|
||||
}
|
||||
|
||||
av_buffer_unref(&ist->hw_frames_ctx);
|
||||
|
||||
ist->hwaccel_ctx = 0;
|
||||
ist->hwaccel_uninit = 0;
|
||||
ist->hwaccel_get_buffer = 0;
|
||||
ist->hwaccel_retrieve_data = 0;
|
||||
}
|
||||
|
||||
int vaapi_decode_init(AVCodecContext *avctx)
|
||||
{
|
||||
InputStream *ist = avctx->opaque;
|
||||
AVVAAPIDeviceContext *hwctx;
|
||||
AVVAAPIFramesContext *avfc;
|
||||
VAAPIDecoderContext *ctx;
|
||||
VAStatus vas;
|
||||
int err;
|
||||
int loglevel = (ist->hwaccel_id != HWACCEL_VAAPI ? AV_LOG_VERBOSE
|
||||
: AV_LOG_ERROR);
|
||||
|
||||
if (ist->hwaccel_ctx)
|
||||
vaapi_decode_uninit(avctx);
|
||||
|
||||
// We have -hwaccel without -vaapi_device, so just initialise here with
|
||||
// the device passed as -hwaccel_device (if -vaapi_device was passed, it
|
||||
// will always have been called before now).
|
||||
if (!hw_device_ctx) {
|
||||
err = vaapi_device_init(ist->hwaccel_device);
|
||||
if (err < 0)
|
||||
return err;
|
||||
}
|
||||
|
||||
ctx = av_mallocz(sizeof(*ctx));
|
||||
if (!ctx)
|
||||
return AVERROR(ENOMEM);
|
||||
ctx->class = &vaapi_class;
|
||||
|
||||
ctx->device_ref = av_buffer_ref(hw_device_ctx);
|
||||
ctx->device = (AVHWDeviceContext*)ctx->device_ref->data;
|
||||
|
||||
ctx->va_config = VA_INVALID_ID;
|
||||
ctx->va_context = VA_INVALID_ID;
|
||||
|
||||
hwctx = ctx->device->hwctx;
|
||||
|
||||
ctx->output_format = ist->hwaccel_output_format;
|
||||
|
||||
err = vaapi_build_decoder_config(ctx, avctx,
|
||||
ist->hwaccel_id != HWACCEL_VAAPI);
|
||||
if (err < 0) {
|
||||
av_log(ctx, loglevel, "No supported configuration for this codec.");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
avctx->pix_fmt = ctx->output_format;
|
||||
|
||||
ctx->frames_ref = av_hwframe_ctx_alloc(ctx->device_ref);
|
||||
if (!ctx->frames_ref) {
|
||||
av_log(ctx, loglevel, "Failed to create VAAPI frame context.\n");
|
||||
err = AVERROR(ENOMEM);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
ctx->frames = (AVHWFramesContext*)ctx->frames_ref->data;
|
||||
|
||||
ctx->frames->format = AV_PIX_FMT_VAAPI;
|
||||
ctx->frames->sw_format = ctx->decode_format;
|
||||
ctx->frames->width = ctx->decode_width;
|
||||
ctx->frames->height = ctx->decode_height;
|
||||
ctx->frames->initial_pool_size = ctx->decode_surfaces;
|
||||
|
||||
err = av_hwframe_ctx_init(ctx->frames_ref);
|
||||
if (err < 0) {
|
||||
av_log(ctx, loglevel, "Failed to initialise VAAPI frame "
|
||||
"context: %d\n", err);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
avfc = ctx->frames->hwctx;
|
||||
|
||||
vas = vaCreateContext(hwctx->display, ctx->va_config,
|
||||
ctx->decode_width, ctx->decode_height,
|
||||
VA_PROGRESSIVE,
|
||||
avfc->surface_ids, avfc->nb_surfaces,
|
||||
&ctx->va_context);
|
||||
if (vas != VA_STATUS_SUCCESS) {
|
||||
av_log(ctx, AV_LOG_ERROR, "Failed to create decode pipeline "
|
||||
"context: %d (%s).\n", vas, vaErrorStr(vas));
|
||||
err = AVERROR(EINVAL);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
av_log(ctx, AV_LOG_DEBUG, "VAAPI decoder (re)init complete.\n");
|
||||
|
||||
// We would like to set this on the AVCodecContext for use by whoever gets
|
||||
// the frames from the decoder, but unfortunately the AVCodecContext we
|
||||
// have here need not be the "real" one (H.264 makes many copies for
|
||||
// threading purposes). To avoid the problem, we instead store it in the
|
||||
// InputStream and propagate it from there.
|
||||
ist->hw_frames_ctx = av_buffer_ref(ctx->frames_ref);
|
||||
if (!ist->hw_frames_ctx) {
|
||||
err = AVERROR(ENOMEM);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
ist->hwaccel_ctx = ctx;
|
||||
ist->hwaccel_uninit = vaapi_decode_uninit;
|
||||
ist->hwaccel_get_buffer = vaapi_get_buffer;
|
||||
ist->hwaccel_retrieve_data = vaapi_retrieve_data;
|
||||
|
||||
ctx->decoder_vaapi_context.display = hwctx->display;
|
||||
ctx->decoder_vaapi_context.config_id = ctx->va_config;
|
||||
ctx->decoder_vaapi_context.context_id = ctx->va_context;
|
||||
avctx->hwaccel_context = &ctx->decoder_vaapi_context;
|
||||
|
||||
return 0;
|
||||
|
||||
fail:
|
||||
vaapi_decode_uninit(avctx);
|
||||
return err;
|
||||
}
|
||||
|
||||
static AVClass *vaapi_log = &vaapi_class;
|
||||
|
||||
av_cold int vaapi_device_init(const char *device)
|
||||
{
|
||||
int err;
|
||||
|
||||
err = av_hwdevice_ctx_create(&hw_device_ctx, AV_HWDEVICE_TYPE_VAAPI,
|
||||
device, NULL, 0);
|
||||
if (err < 0) {
|
||||
av_log(&vaapi_log, AV_LOG_ERROR, "Failed to create a VAAPI device\n");
|
||||
return err;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
289
ffmpeg_vdpau.c
289
ffmpeg_vdpau.c
@@ -18,21 +18,49 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <vdpau/vdpau.h>
|
||||
#include <vdpau/vdpau_x11.h>
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
|
||||
#include "ffmpeg.h"
|
||||
|
||||
#include "libavcodec/vdpau.h"
|
||||
|
||||
#include "libavutil/avassert.h"
|
||||
#include "libavutil/buffer.h"
|
||||
#include "libavutil/frame.h"
|
||||
#include "libavutil/hwcontext.h"
|
||||
#include "libavutil/hwcontext_vdpau.h"
|
||||
#include "libavutil/pixfmt.h"
|
||||
|
||||
typedef struct VDPAUContext {
|
||||
AVBufferRef *hw_frames_ctx;
|
||||
Display *dpy;
|
||||
|
||||
VdpDevice device;
|
||||
VdpDecoder decoder;
|
||||
VdpGetProcAddress *get_proc_address;
|
||||
|
||||
VdpGetErrorString *get_error_string;
|
||||
VdpGetInformationString *get_information_string;
|
||||
VdpDeviceDestroy *device_destroy;
|
||||
#if 1 // for ffmpegs older vdpau API, not the oldest though
|
||||
VdpDecoderCreate *decoder_create;
|
||||
VdpDecoderDestroy *decoder_destroy;
|
||||
VdpDecoderRender *decoder_render;
|
||||
#endif
|
||||
VdpVideoSurfaceCreate *video_surface_create;
|
||||
VdpVideoSurfaceDestroy *video_surface_destroy;
|
||||
VdpVideoSurfaceGetBitsYCbCr *video_surface_get_bits;
|
||||
VdpVideoSurfaceGetParameters *video_surface_get_parameters;
|
||||
VdpVideoSurfaceQueryGetPutBitsYCbCrCapabilities *video_surface_query;
|
||||
|
||||
AVFrame *tmp_frame;
|
||||
|
||||
enum AVPixelFormat pix_fmt;
|
||||
VdpYCbCrFormat vdpau_format;
|
||||
} VDPAUContext;
|
||||
|
||||
int vdpau_api_ver = 2;
|
||||
|
||||
static void vdpau_uninit(AVCodecContext *s)
|
||||
{
|
||||
InputStream *ist = s->opaque;
|
||||
@@ -42,54 +70,140 @@ static void vdpau_uninit(AVCodecContext *s)
|
||||
ist->hwaccel_get_buffer = NULL;
|
||||
ist->hwaccel_retrieve_data = NULL;
|
||||
|
||||
av_buffer_unref(&ctx->hw_frames_ctx);
|
||||
if (ctx->decoder_destroy)
|
||||
ctx->decoder_destroy(ctx->decoder);
|
||||
|
||||
if (ctx->device_destroy)
|
||||
ctx->device_destroy(ctx->device);
|
||||
|
||||
if (ctx->dpy)
|
||||
XCloseDisplay(ctx->dpy);
|
||||
|
||||
av_frame_free(&ctx->tmp_frame);
|
||||
|
||||
av_freep(&ist->hwaccel_ctx);
|
||||
av_freep(&s->hwaccel_context);
|
||||
}
|
||||
|
||||
static void vdpau_release_buffer(void *opaque, uint8_t *data)
|
||||
{
|
||||
VdpVideoSurface surface = *(VdpVideoSurface*)data;
|
||||
VDPAUContext *ctx = opaque;
|
||||
|
||||
ctx->video_surface_destroy(surface);
|
||||
av_freep(&data);
|
||||
}
|
||||
|
||||
static int vdpau_get_buffer(AVCodecContext *s, AVFrame *frame, int flags)
|
||||
{
|
||||
InputStream *ist = s->opaque;
|
||||
VDPAUContext *ctx = ist->hwaccel_ctx;
|
||||
VdpVideoSurface *surface;
|
||||
VdpStatus err;
|
||||
VdpChromaType chroma;
|
||||
uint32_t width, height;
|
||||
|
||||
return av_hwframe_get_buffer(ctx->hw_frames_ctx, frame, 0);
|
||||
av_assert0(frame->format == AV_PIX_FMT_VDPAU);
|
||||
|
||||
if (av_vdpau_get_surface_parameters(s, &chroma, &width, &height))
|
||||
return AVERROR(ENOSYS);
|
||||
|
||||
surface = av_malloc(sizeof(*surface));
|
||||
if (!surface)
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
frame->buf[0] = av_buffer_create((uint8_t*)surface, sizeof(*surface),
|
||||
vdpau_release_buffer, ctx,
|
||||
AV_BUFFER_FLAG_READONLY);
|
||||
if (!frame->buf[0]) {
|
||||
av_freep(&surface);
|
||||
return AVERROR(ENOMEM);
|
||||
}
|
||||
|
||||
// properly we should keep a pool of surfaces instead of creating
|
||||
// them anew for each frame, but since we don't care about speed
|
||||
// much in this code, we don't bother
|
||||
err = ctx->video_surface_create(ctx->device, chroma, width, height,
|
||||
surface);
|
||||
if (err != VDP_STATUS_OK) {
|
||||
av_log(NULL, AV_LOG_ERROR, "Error allocating a VDPAU video surface: %s\n",
|
||||
ctx->get_error_string(err));
|
||||
av_buffer_unref(&frame->buf[0]);
|
||||
return AVERROR_UNKNOWN;
|
||||
}
|
||||
|
||||
frame->data[3] = (uint8_t*)(uintptr_t)*surface;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int vdpau_retrieve_data(AVCodecContext *s, AVFrame *frame)
|
||||
{
|
||||
VdpVideoSurface surface = (VdpVideoSurface)(uintptr_t)frame->data[3];
|
||||
InputStream *ist = s->opaque;
|
||||
VDPAUContext *ctx = ist->hwaccel_ctx;
|
||||
int ret;
|
||||
VdpStatus err;
|
||||
int ret, chroma_type;
|
||||
|
||||
ret = av_hwframe_transfer_data(ctx->tmp_frame, frame, 0);
|
||||
err = ctx->video_surface_get_parameters(surface, &chroma_type,
|
||||
&ctx->tmp_frame->width,
|
||||
&ctx->tmp_frame->height);
|
||||
if (err != VDP_STATUS_OK) {
|
||||
av_log(NULL, AV_LOG_ERROR, "Error getting surface parameters: %s\n",
|
||||
ctx->get_error_string(err));
|
||||
return AVERROR_UNKNOWN;
|
||||
}
|
||||
ctx->tmp_frame->format = ctx->pix_fmt;
|
||||
|
||||
ret = av_frame_get_buffer(ctx->tmp_frame, 32);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
ret = av_frame_copy_props(ctx->tmp_frame, frame);
|
||||
if (ret < 0) {
|
||||
av_frame_unref(ctx->tmp_frame);
|
||||
return ret;
|
||||
ctx->tmp_frame->width = frame->width;
|
||||
ctx->tmp_frame->height = frame->height;
|
||||
|
||||
err = ctx->video_surface_get_bits(surface, ctx->vdpau_format,
|
||||
(void * const *)ctx->tmp_frame->data,
|
||||
ctx->tmp_frame->linesize);
|
||||
if (err != VDP_STATUS_OK) {
|
||||
av_log(NULL, AV_LOG_ERROR, "Error retrieving frame data from VDPAU: %s\n",
|
||||
ctx->get_error_string(err));
|
||||
ret = AVERROR_UNKNOWN;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (ctx->vdpau_format == VDP_YCBCR_FORMAT_YV12)
|
||||
FFSWAP(uint8_t*, ctx->tmp_frame->data[1], ctx->tmp_frame->data[2]);
|
||||
|
||||
ret = av_frame_copy_props(ctx->tmp_frame, frame);
|
||||
if (ret < 0)
|
||||
goto fail;
|
||||
|
||||
av_frame_unref(frame);
|
||||
av_frame_move_ref(frame, ctx->tmp_frame);
|
||||
|
||||
return 0;
|
||||
|
||||
fail:
|
||||
av_frame_unref(ctx->tmp_frame);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static const int vdpau_formats[][2] = {
|
||||
{ VDP_YCBCR_FORMAT_YV12, AV_PIX_FMT_YUV420P },
|
||||
{ VDP_YCBCR_FORMAT_NV12, AV_PIX_FMT_NV12 },
|
||||
{ VDP_YCBCR_FORMAT_YUYV, AV_PIX_FMT_YUYV422 },
|
||||
{ VDP_YCBCR_FORMAT_UYVY, AV_PIX_FMT_UYVY422 },
|
||||
};
|
||||
|
||||
static int vdpau_alloc(AVCodecContext *s)
|
||||
{
|
||||
InputStream *ist = s->opaque;
|
||||
int loglevel = (ist->hwaccel_id == HWACCEL_AUTO) ? AV_LOG_VERBOSE : AV_LOG_ERROR;
|
||||
AVVDPAUContext *vdpau_ctx;
|
||||
VDPAUContext *ctx;
|
||||
int ret;
|
||||
|
||||
AVBufferRef *device_ref = NULL;
|
||||
AVHWDeviceContext *device_ctx;
|
||||
AVVDPAUDeviceContext *device_hwctx;
|
||||
AVHWFramesContext *frames_ctx;
|
||||
const char *display, *vendor;
|
||||
VdpStatus err;
|
||||
int i;
|
||||
|
||||
ctx = av_mallocz(sizeof(*ctx));
|
||||
if (!ctx)
|
||||
@@ -104,48 +218,145 @@ static int vdpau_alloc(AVCodecContext *s)
|
||||
if (!ctx->tmp_frame)
|
||||
goto fail;
|
||||
|
||||
ret = av_hwdevice_ctx_create(&device_ref, AV_HWDEVICE_TYPE_VDPAU,
|
||||
ist->hwaccel_device, NULL, 0);
|
||||
if (ret < 0)
|
||||
ctx->dpy = XOpenDisplay(ist->hwaccel_device);
|
||||
if (!ctx->dpy) {
|
||||
av_log(NULL, loglevel, "Cannot open the X11 display %s.\n",
|
||||
XDisplayName(ist->hwaccel_device));
|
||||
goto fail;
|
||||
device_ctx = (AVHWDeviceContext*)device_ref->data;
|
||||
device_hwctx = device_ctx->hwctx;
|
||||
}
|
||||
display = XDisplayString(ctx->dpy);
|
||||
|
||||
ctx->hw_frames_ctx = av_hwframe_ctx_alloc(device_ref);
|
||||
if (!ctx->hw_frames_ctx)
|
||||
err = vdp_device_create_x11(ctx->dpy, XDefaultScreen(ctx->dpy), &ctx->device,
|
||||
&ctx->get_proc_address);
|
||||
if (err != VDP_STATUS_OK) {
|
||||
av_log(NULL, loglevel, "VDPAU device creation on X11 display %s failed.\n",
|
||||
display);
|
||||
goto fail;
|
||||
av_buffer_unref(&device_ref);
|
||||
}
|
||||
|
||||
frames_ctx = (AVHWFramesContext*)ctx->hw_frames_ctx->data;
|
||||
frames_ctx->format = AV_PIX_FMT_VDPAU;
|
||||
frames_ctx->sw_format = s->sw_pix_fmt;
|
||||
frames_ctx->width = s->coded_width;
|
||||
frames_ctx->height = s->coded_height;
|
||||
#define GET_CALLBACK(id, result) \
|
||||
do { \
|
||||
void *tmp; \
|
||||
err = ctx->get_proc_address(ctx->device, id, &tmp); \
|
||||
if (err != VDP_STATUS_OK) { \
|
||||
av_log(NULL, loglevel, "Error getting the " #id " callback.\n"); \
|
||||
goto fail; \
|
||||
} \
|
||||
ctx->result = tmp; \
|
||||
} while (0)
|
||||
|
||||
ret = av_hwframe_ctx_init(ctx->hw_frames_ctx);
|
||||
if (ret < 0)
|
||||
GET_CALLBACK(VDP_FUNC_ID_GET_ERROR_STRING, get_error_string);
|
||||
GET_CALLBACK(VDP_FUNC_ID_GET_INFORMATION_STRING, get_information_string);
|
||||
GET_CALLBACK(VDP_FUNC_ID_DEVICE_DESTROY, device_destroy);
|
||||
if (vdpau_api_ver == 1) {
|
||||
GET_CALLBACK(VDP_FUNC_ID_DECODER_CREATE, decoder_create);
|
||||
GET_CALLBACK(VDP_FUNC_ID_DECODER_DESTROY, decoder_destroy);
|
||||
GET_CALLBACK(VDP_FUNC_ID_DECODER_RENDER, decoder_render);
|
||||
}
|
||||
GET_CALLBACK(VDP_FUNC_ID_VIDEO_SURFACE_CREATE, video_surface_create);
|
||||
GET_CALLBACK(VDP_FUNC_ID_VIDEO_SURFACE_DESTROY, video_surface_destroy);
|
||||
GET_CALLBACK(VDP_FUNC_ID_VIDEO_SURFACE_GET_BITS_Y_CB_CR, video_surface_get_bits);
|
||||
GET_CALLBACK(VDP_FUNC_ID_VIDEO_SURFACE_GET_PARAMETERS, video_surface_get_parameters);
|
||||
GET_CALLBACK(VDP_FUNC_ID_VIDEO_SURFACE_QUERY_GET_PUT_BITS_Y_CB_CR_CAPABILITIES,
|
||||
video_surface_query);
|
||||
|
||||
for (i = 0; i < FF_ARRAY_ELEMS(vdpau_formats); i++) {
|
||||
VdpBool supported;
|
||||
err = ctx->video_surface_query(ctx->device, VDP_CHROMA_TYPE_420,
|
||||
vdpau_formats[i][0], &supported);
|
||||
if (err != VDP_STATUS_OK) {
|
||||
av_log(NULL, loglevel,
|
||||
"Error querying VDPAU surface capabilities: %s\n",
|
||||
ctx->get_error_string(err));
|
||||
goto fail;
|
||||
}
|
||||
if (supported)
|
||||
break;
|
||||
}
|
||||
if (i == FF_ARRAY_ELEMS(vdpau_formats)) {
|
||||
av_log(NULL, loglevel,
|
||||
"No supported VDPAU format for retrieving the data.\n");
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
ctx->vdpau_format = vdpau_formats[i][0];
|
||||
ctx->pix_fmt = vdpau_formats[i][1];
|
||||
|
||||
if (vdpau_api_ver == 1) {
|
||||
vdpau_ctx = av_vdpau_alloc_context();
|
||||
if (!vdpau_ctx)
|
||||
goto fail;
|
||||
vdpau_ctx->render = ctx->decoder_render;
|
||||
|
||||
s->hwaccel_context = vdpau_ctx;
|
||||
} else
|
||||
if (av_vdpau_bind_context(s, ctx->device, ctx->get_proc_address,
|
||||
AV_HWACCEL_FLAG_IGNORE_LEVEL))
|
||||
goto fail;
|
||||
|
||||
if (av_vdpau_bind_context(s, device_hwctx->device, device_hwctx->get_proc_address, 0))
|
||||
goto fail;
|
||||
|
||||
av_log(NULL, AV_LOG_VERBOSE, "Using VDPAU to decode input stream #%d:%d.\n",
|
||||
ist->file_index, ist->st->index);
|
||||
ctx->get_information_string(&vendor);
|
||||
av_log(NULL, AV_LOG_VERBOSE, "Using VDPAU -- %s -- on X11 display %s, "
|
||||
"to decode input stream #%d:%d.\n", vendor,
|
||||
display, ist->file_index, ist->st->index);
|
||||
|
||||
return 0;
|
||||
|
||||
fail:
|
||||
av_log(NULL, loglevel, "VDPAU init failed for stream #%d:%d.\n",
|
||||
ist->file_index, ist->st->index);
|
||||
av_buffer_unref(&device_ref);
|
||||
vdpau_uninit(s);
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
|
||||
static int vdpau_old_init(AVCodecContext *s)
|
||||
{
|
||||
InputStream *ist = s->opaque;
|
||||
int loglevel = (ist->hwaccel_id == HWACCEL_AUTO) ? AV_LOG_VERBOSE : AV_LOG_ERROR;
|
||||
AVVDPAUContext *vdpau_ctx;
|
||||
VDPAUContext *ctx;
|
||||
VdpStatus err;
|
||||
int profile, ret;
|
||||
|
||||
if (!ist->hwaccel_ctx) {
|
||||
ret = vdpau_alloc(s);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
}
|
||||
ctx = ist->hwaccel_ctx;
|
||||
vdpau_ctx = s->hwaccel_context;
|
||||
|
||||
ret = av_vdpau_get_profile(s, &profile);
|
||||
if (ret < 0) {
|
||||
av_log(NULL, loglevel, "No known VDPAU decoder profile for this stream.\n");
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
|
||||
if (ctx->decoder)
|
||||
ctx->decoder_destroy(ctx->decoder);
|
||||
|
||||
err = ctx->decoder_create(ctx->device, profile,
|
||||
s->coded_width, s->coded_height,
|
||||
16, &ctx->decoder);
|
||||
if (err != VDP_STATUS_OK) {
|
||||
av_log(NULL, loglevel, "Error creating the VDPAU decoder: %s\n",
|
||||
ctx->get_error_string(err));
|
||||
return AVERROR_UNKNOWN;
|
||||
}
|
||||
|
||||
vdpau_ctx->decoder = ctx->decoder;
|
||||
|
||||
ist->hwaccel_get_buffer = vdpau_get_buffer;
|
||||
ist->hwaccel_retrieve_data = vdpau_retrieve_data;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int vdpau_init(AVCodecContext *s)
|
||||
{
|
||||
InputStream *ist = s->opaque;
|
||||
|
||||
if (vdpau_api_ver == 1)
|
||||
return vdpau_old_init(s);
|
||||
|
||||
if (!ist->hwaccel_ctx) {
|
||||
int ret = vdpau_alloc(s);
|
||||
if (ret < 0)
|
||||
|
||||
524
ffprobe.c
524
ffprobe.c
@@ -37,7 +37,6 @@
|
||||
#include "libavutil/hash.h"
|
||||
#include "libavutil/opt.h"
|
||||
#include "libavutil/pixdesc.h"
|
||||
#include "libavutil/stereo3d.h"
|
||||
#include "libavutil/dict.h"
|
||||
#include "libavutil/intreadwrite.h"
|
||||
#include "libavutil/libm.h"
|
||||
@@ -50,19 +49,6 @@
|
||||
#include "libpostproc/postprocess.h"
|
||||
#include "cmdutils.h"
|
||||
|
||||
typedef struct InputStream {
|
||||
AVStream *st;
|
||||
|
||||
AVCodecContext *dec_ctx;
|
||||
} InputStream;
|
||||
|
||||
typedef struct InputFile {
|
||||
AVFormatContext *fmt_ctx;
|
||||
|
||||
InputStream *streams;
|
||||
int nb_streams;
|
||||
} InputFile;
|
||||
|
||||
const char program_name[] = "ffprobe";
|
||||
const int program_birth_year = 2007;
|
||||
|
||||
@@ -1760,39 +1746,10 @@ static inline int show_tags(WriterContext *w, AVDictionary *tags, int section_id
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void print_pkt_side_data(WriterContext *w,
|
||||
const AVPacketSideData *side_data,
|
||||
int nb_side_data,
|
||||
SectionID id_data_list,
|
||||
SectionID id_data)
|
||||
{
|
||||
int i;
|
||||
|
||||
writer_print_section_header(w, SECTION_ID_STREAM_SIDE_DATA_LIST);
|
||||
for (i = 0; i < nb_side_data; i++) {
|
||||
const AVPacketSideData *sd = &side_data[i];
|
||||
const char *name = av_packet_side_data_name(sd->type);
|
||||
|
||||
writer_print_section_header(w, SECTION_ID_STREAM_SIDE_DATA);
|
||||
print_str("side_data_type", name ? name : "unknown");
|
||||
print_int("side_data_size", sd->size);
|
||||
if (sd->type == AV_PKT_DATA_DISPLAYMATRIX && sd->size >= 9*4) {
|
||||
writer_print_integers(w, "displaymatrix", sd->data, 9, " %11d", 3, 4, 1);
|
||||
print_int("rotation", av_display_rotation_get((int32_t *)sd->data));
|
||||
} else if (sd->type == AV_PKT_DATA_STEREO3D) {
|
||||
const AVStereo3D *stereo = (AVStereo3D *)sd->data;
|
||||
print_str("type", av_stereo3d_type_name(stereo->type));
|
||||
print_int("inverted", !!(stereo->flags & AV_STEREO3D_FLAG_INVERT));
|
||||
}
|
||||
writer_print_section_footer(w);
|
||||
}
|
||||
writer_print_section_footer(w);
|
||||
}
|
||||
|
||||
static void show_packet(WriterContext *w, InputFile *ifile, AVPacket *pkt, int packet_idx)
|
||||
static void show_packet(WriterContext *w, AVFormatContext *fmt_ctx, AVPacket *pkt, int packet_idx)
|
||||
{
|
||||
char val_str[128];
|
||||
AVStream *st = ifile->streams[pkt->stream_index].st;
|
||||
AVStream *st = fmt_ctx->streams[pkt->stream_index];
|
||||
AVBPrint pbuf;
|
||||
const char *s;
|
||||
|
||||
@@ -1800,7 +1757,7 @@ static void show_packet(WriterContext *w, InputFile *ifile, AVPacket *pkt, int p
|
||||
|
||||
writer_print_section_header(w, SECTION_ID_PACKET);
|
||||
|
||||
s = av_get_media_type_string(st->codecpar->codec_type);
|
||||
s = av_get_media_type_string(st->codec->codec_type);
|
||||
if (s) print_str ("codec_type", s);
|
||||
else print_str_opt("codec_type", "unknown");
|
||||
print_int("stream_index", pkt->stream_index);
|
||||
@@ -1815,10 +1772,10 @@ static void show_packet(WriterContext *w, InputFile *ifile, AVPacket *pkt, int p
|
||||
print_val("size", pkt->size, unit_byte_str);
|
||||
if (pkt->pos != -1) print_fmt ("pos", "%"PRId64, pkt->pos);
|
||||
else print_str_opt("pos", "N/A");
|
||||
print_fmt("flags", "%c%c", pkt->flags & AV_PKT_FLAG_KEY ? 'K' : '_',
|
||||
pkt->flags & AV_PKT_FLAG_DISCARD ? 'D' : '_');
|
||||
print_fmt("flags", "%c", pkt->flags & AV_PKT_FLAG_KEY ? 'K' : '_');
|
||||
|
||||
if (pkt->side_data_elems) {
|
||||
int i;
|
||||
int size;
|
||||
const uint8_t *side_metadata;
|
||||
|
||||
@@ -1829,10 +1786,20 @@ static void show_packet(WriterContext *w, InputFile *ifile, AVPacket *pkt, int p
|
||||
show_tags(w, dict, SECTION_ID_PACKET_TAGS);
|
||||
av_dict_free(&dict);
|
||||
}
|
||||
|
||||
print_pkt_side_data(w, pkt->side_data, pkt->side_data_elems,
|
||||
SECTION_ID_PACKET_SIDE_DATA_LIST,
|
||||
SECTION_ID_PACKET_SIDE_DATA);
|
||||
writer_print_section_header(w, SECTION_ID_PACKET_SIDE_DATA_LIST);
|
||||
for (i = 0; i < pkt->side_data_elems; i++) {
|
||||
AVPacketSideData *sd = &pkt->side_data[i];
|
||||
const char *name = av_packet_side_data_name(sd->type);
|
||||
writer_print_section_header(w, SECTION_ID_PACKET_SIDE_DATA);
|
||||
print_str("side_data_type", name ? name : "unknown");
|
||||
print_int("side_data_size", sd->size);
|
||||
if (sd->type == AV_PKT_DATA_DISPLAYMATRIX && sd->size >= 9*4) {
|
||||
writer_print_integers(w, "displaymatrix", sd->data, 9, " %11d", 3, 4, 1);
|
||||
print_int("rotation", av_display_rotation_get((int32_t *)sd->data));
|
||||
}
|
||||
writer_print_section_footer(w);
|
||||
}
|
||||
writer_print_section_footer(w);
|
||||
}
|
||||
|
||||
if (do_show_data)
|
||||
@@ -1879,13 +1846,13 @@ static void show_frame(WriterContext *w, AVFrame *frame, AVStream *stream,
|
||||
|
||||
writer_print_section_header(w, SECTION_ID_FRAME);
|
||||
|
||||
s = av_get_media_type_string(stream->codecpar->codec_type);
|
||||
s = av_get_media_type_string(stream->codec->codec_type);
|
||||
if (s) print_str ("media_type", s);
|
||||
else print_str_opt("media_type", "unknown");
|
||||
print_int("stream_index", stream->index);
|
||||
print_int("key_frame", frame->key_frame);
|
||||
print_ts ("pkt_pts", frame->pts);
|
||||
print_time("pkt_pts_time", frame->pts, &stream->time_base);
|
||||
print_ts ("pkt_pts", frame->pkt_pts);
|
||||
print_time("pkt_pts_time", frame->pkt_pts, &stream->time_base);
|
||||
print_ts ("pkt_dts", frame->pkt_dts);
|
||||
print_time("pkt_dts_time", frame->pkt_dts, &stream->time_base);
|
||||
print_ts ("best_effort_timestamp", av_frame_get_best_effort_timestamp(frame));
|
||||
@@ -1897,7 +1864,7 @@ static void show_frame(WriterContext *w, AVFrame *frame, AVStream *stream,
|
||||
if (av_frame_get_pkt_size(frame) != -1) print_val ("pkt_size", av_frame_get_pkt_size(frame), unit_byte_str);
|
||||
else print_str_opt("pkt_size", "N/A");
|
||||
|
||||
switch (stream->codecpar->codec_type) {
|
||||
switch (stream->codec->codec_type) {
|
||||
AVRational sar;
|
||||
|
||||
case AVMEDIA_TYPE_VIDEO:
|
||||
@@ -1967,17 +1934,15 @@ static void show_frame(WriterContext *w, AVFrame *frame, AVStream *stream,
|
||||
}
|
||||
|
||||
static av_always_inline int process_frame(WriterContext *w,
|
||||
InputFile *ifile,
|
||||
AVFormatContext *fmt_ctx,
|
||||
AVFrame *frame, AVPacket *pkt)
|
||||
{
|
||||
AVFormatContext *fmt_ctx = ifile->fmt_ctx;
|
||||
AVCodecContext *dec_ctx = ifile->streams[pkt->stream_index].dec_ctx;
|
||||
AVCodecParameters *par = ifile->streams[pkt->stream_index].st->codecpar;
|
||||
AVCodecContext *dec_ctx = fmt_ctx->streams[pkt->stream_index]->codec;
|
||||
AVSubtitle sub;
|
||||
int ret = 0, got_frame = 0;
|
||||
|
||||
if (dec_ctx && dec_ctx->codec) {
|
||||
switch (par->codec_type) {
|
||||
if (dec_ctx->codec) {
|
||||
switch (dec_ctx->codec_type) {
|
||||
case AVMEDIA_TYPE_VIDEO:
|
||||
ret = avcodec_decode_video2(dec_ctx, frame, &got_frame, pkt);
|
||||
break;
|
||||
@@ -1998,13 +1963,13 @@ static av_always_inline int process_frame(WriterContext *w,
|
||||
pkt->data += ret;
|
||||
pkt->size -= ret;
|
||||
if (got_frame) {
|
||||
int is_sub = (par->codec_type == AVMEDIA_TYPE_SUBTITLE);
|
||||
int is_sub = (dec_ctx->codec_type == AVMEDIA_TYPE_SUBTITLE);
|
||||
nb_streams_frames[pkt->stream_index]++;
|
||||
if (do_show_frames)
|
||||
if (is_sub)
|
||||
show_subtitle(w, &sub, ifile->streams[pkt->stream_index].st, fmt_ctx);
|
||||
show_subtitle(w, &sub, fmt_ctx->streams[pkt->stream_index], fmt_ctx);
|
||||
else
|
||||
show_frame(w, frame, ifile->streams[pkt->stream_index].st, fmt_ctx);
|
||||
show_frame(w, frame, fmt_ctx->streams[pkt->stream_index], fmt_ctx);
|
||||
if (is_sub)
|
||||
avsubtitle_free(&sub);
|
||||
}
|
||||
@@ -2035,10 +2000,9 @@ static void log_read_interval(const ReadInterval *interval, void *log_ctx, int l
|
||||
av_log(log_ctx, log_level, "\n");
|
||||
}
|
||||
|
||||
static int read_interval_packets(WriterContext *w, InputFile *ifile,
|
||||
static int read_interval_packets(WriterContext *w, AVFormatContext *fmt_ctx,
|
||||
const ReadInterval *interval, int64_t *cur_ts)
|
||||
{
|
||||
AVFormatContext *fmt_ctx = ifile->fmt_ctx;
|
||||
AVPacket pkt, pkt1;
|
||||
AVFrame *frame = NULL;
|
||||
int ret = 0, i = 0, frame_count = 0;
|
||||
@@ -2080,14 +2044,14 @@ static int read_interval_packets(WriterContext *w, InputFile *ifile,
|
||||
goto end;
|
||||
}
|
||||
while (!av_read_frame(fmt_ctx, &pkt)) {
|
||||
if (ifile->nb_streams > nb_streams) {
|
||||
if (fmt_ctx->nb_streams > nb_streams) {
|
||||
REALLOCZ_ARRAY_STREAM(nb_streams_frames, nb_streams, fmt_ctx->nb_streams);
|
||||
REALLOCZ_ARRAY_STREAM(nb_streams_packets, nb_streams, fmt_ctx->nb_streams);
|
||||
REALLOCZ_ARRAY_STREAM(selected_streams, nb_streams, fmt_ctx->nb_streams);
|
||||
nb_streams = ifile->nb_streams;
|
||||
nb_streams = fmt_ctx->nb_streams;
|
||||
}
|
||||
if (selected_streams[pkt.stream_index]) {
|
||||
AVRational tb = ifile->streams[pkt.stream_index].st->time_base;
|
||||
AVRational tb = fmt_ctx->streams[pkt.stream_index]->time_base;
|
||||
|
||||
if (pkt.pts != AV_NOPTS_VALUE)
|
||||
*cur_ts = av_rescale_q(pkt.pts, tb, AV_TIME_BASE_Q);
|
||||
@@ -2112,12 +2076,12 @@ static int read_interval_packets(WriterContext *w, InputFile *ifile,
|
||||
frame_count++;
|
||||
if (do_read_packets) {
|
||||
if (do_show_packets)
|
||||
show_packet(w, ifile, &pkt, i++);
|
||||
show_packet(w, fmt_ctx, &pkt, i++);
|
||||
nb_streams_packets[pkt.stream_index]++;
|
||||
}
|
||||
if (do_read_frames) {
|
||||
pkt1 = pkt;
|
||||
while (pkt1.size && process_frame(w, ifile, frame, &pkt1) > 0);
|
||||
while (pkt1.size && process_frame(w, fmt_ctx, frame, &pkt1) > 0);
|
||||
}
|
||||
}
|
||||
av_packet_unref(&pkt);
|
||||
@@ -2129,7 +2093,7 @@ static int read_interval_packets(WriterContext *w, InputFile *ifile,
|
||||
for (i = 0; i < fmt_ctx->nb_streams; i++) {
|
||||
pkt.stream_index = i;
|
||||
if (do_read_frames)
|
||||
while (process_frame(w, ifile, frame, &pkt) > 0);
|
||||
while (process_frame(w, fmt_ctx, frame, &pkt) > 0);
|
||||
}
|
||||
|
||||
end:
|
||||
@@ -2141,18 +2105,17 @@ end:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int read_packets(WriterContext *w, InputFile *ifile)
|
||||
static int read_packets(WriterContext *w, AVFormatContext *fmt_ctx)
|
||||
{
|
||||
AVFormatContext *fmt_ctx = ifile->fmt_ctx;
|
||||
int i, ret = 0;
|
||||
int64_t cur_ts = fmt_ctx->start_time;
|
||||
|
||||
if (read_intervals_nb == 0) {
|
||||
ReadInterval interval = (ReadInterval) { .has_start = 0, .has_end = 0 };
|
||||
ret = read_interval_packets(w, ifile, &interval, &cur_ts);
|
||||
ret = read_interval_packets(w, fmt_ctx, &interval, &cur_ts);
|
||||
} else {
|
||||
for (i = 0; i < read_intervals_nb; i++) {
|
||||
ret = read_interval_packets(w, ifile, &read_intervals[i], &cur_ts);
|
||||
ret = read_interval_packets(w, fmt_ctx, &read_intervals[i], &cur_ts);
|
||||
if (ret < 0)
|
||||
break;
|
||||
}
|
||||
@@ -2161,18 +2124,17 @@ static int read_packets(WriterContext *w, InputFile *ifile)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int show_stream(WriterContext *w, AVFormatContext *fmt_ctx, int stream_idx, InputStream *ist, int in_program)
|
||||
static int show_stream(WriterContext *w, AVFormatContext *fmt_ctx, int stream_idx, int in_program)
|
||||
{
|
||||
AVStream *stream = ist->st;
|
||||
AVCodecParameters *par;
|
||||
AVStream *stream = fmt_ctx->streams[stream_idx];
|
||||
AVCodecContext *dec_ctx;
|
||||
const AVCodec *dec;
|
||||
char val_str[128];
|
||||
const char *s;
|
||||
AVRational sar, dar;
|
||||
AVBPrint pbuf;
|
||||
const AVCodecDescriptor *cd;
|
||||
int ret = 0;
|
||||
const char *profile = NULL;
|
||||
|
||||
av_bprint_init(&pbuf, 1, AV_BPRINT_SIZE_UNLIMITED);
|
||||
|
||||
@@ -2180,151 +2142,140 @@ static int show_stream(WriterContext *w, AVFormatContext *fmt_ctx, int stream_id
|
||||
|
||||
print_int("index", stream->index);
|
||||
|
||||
par = stream->codecpar;
|
||||
dec_ctx = ist->dec_ctx;
|
||||
if (cd = avcodec_descriptor_get(par->codec_id)) {
|
||||
print_str("codec_name", cd->name);
|
||||
if (!do_bitexact) {
|
||||
print_str("codec_long_name",
|
||||
cd->long_name ? cd->long_name : "unknown");
|
||||
if ((dec_ctx = stream->codec)) {
|
||||
const char *profile = NULL;
|
||||
dec = dec_ctx->codec;
|
||||
if (dec) {
|
||||
print_str("codec_name", dec->name);
|
||||
if (!do_bitexact) {
|
||||
if (dec->long_name) print_str ("codec_long_name", dec->long_name);
|
||||
else print_str_opt("codec_long_name", "unknown");
|
||||
}
|
||||
} else if ((cd = avcodec_descriptor_get(stream->codec->codec_id))) {
|
||||
print_str_opt("codec_name", cd->name);
|
||||
if (!do_bitexact) {
|
||||
print_str_opt("codec_long_name",
|
||||
cd->long_name ? cd->long_name : "unknown");
|
||||
}
|
||||
} else {
|
||||
print_str_opt("codec_name", "unknown");
|
||||
if (!do_bitexact) {
|
||||
print_str_opt("codec_long_name", "unknown");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
print_str_opt("codec_name", "unknown");
|
||||
if (!do_bitexact) {
|
||||
print_str_opt("codec_long_name", "unknown");
|
||||
|
||||
if (!do_bitexact && dec && (profile = av_get_profile_name(dec, dec_ctx->profile)))
|
||||
print_str("profile", profile);
|
||||
else {
|
||||
if (dec_ctx->profile != FF_PROFILE_UNKNOWN) {
|
||||
char profile_num[12];
|
||||
snprintf(profile_num, sizeof(profile_num), "%d", dec_ctx->profile);
|
||||
print_str("profile", profile_num);
|
||||
} else
|
||||
print_str_opt("profile", "unknown");
|
||||
}
|
||||
}
|
||||
|
||||
if (!do_bitexact && (profile = avcodec_profile_name(par->codec_id, par->profile)))
|
||||
print_str("profile", profile);
|
||||
else {
|
||||
if (par->profile != FF_PROFILE_UNKNOWN) {
|
||||
char profile_num[12];
|
||||
snprintf(profile_num, sizeof(profile_num), "%d", par->profile);
|
||||
print_str("profile", profile_num);
|
||||
} else
|
||||
print_str_opt("profile", "unknown");
|
||||
}
|
||||
|
||||
s = av_get_media_type_string(par->codec_type);
|
||||
if (s) print_str ("codec_type", s);
|
||||
else print_str_opt("codec_type", "unknown");
|
||||
#if FF_API_LAVF_AVCTX
|
||||
if (dec_ctx)
|
||||
s = av_get_media_type_string(dec_ctx->codec_type);
|
||||
if (s) print_str ("codec_type", s);
|
||||
else print_str_opt("codec_type", "unknown");
|
||||
print_q("codec_time_base", dec_ctx->time_base, '/');
|
||||
#endif
|
||||
|
||||
/* print AVI/FourCC tag */
|
||||
av_get_codec_tag_string(val_str, sizeof(val_str), par->codec_tag);
|
||||
print_str("codec_tag_string", val_str);
|
||||
print_fmt("codec_tag", "0x%04x", par->codec_tag);
|
||||
/* print AVI/FourCC tag */
|
||||
av_get_codec_tag_string(val_str, sizeof(val_str), dec_ctx->codec_tag);
|
||||
print_str("codec_tag_string", val_str);
|
||||
print_fmt("codec_tag", "0x%04x", dec_ctx->codec_tag);
|
||||
|
||||
switch (par->codec_type) {
|
||||
case AVMEDIA_TYPE_VIDEO:
|
||||
print_int("width", par->width);
|
||||
print_int("height", par->height);
|
||||
if (dec_ctx) {
|
||||
switch (dec_ctx->codec_type) {
|
||||
case AVMEDIA_TYPE_VIDEO:
|
||||
print_int("width", dec_ctx->width);
|
||||
print_int("height", dec_ctx->height);
|
||||
print_int("coded_width", dec_ctx->coded_width);
|
||||
print_int("coded_height", dec_ctx->coded_height);
|
||||
}
|
||||
print_int("has_b_frames", par->video_delay);
|
||||
sar = av_guess_sample_aspect_ratio(fmt_ctx, stream, NULL);
|
||||
if (sar.den) {
|
||||
print_q("sample_aspect_ratio", sar, ':');
|
||||
av_reduce(&dar.num, &dar.den,
|
||||
par->width * sar.num,
|
||||
par->height * sar.den,
|
||||
1024*1024);
|
||||
print_q("display_aspect_ratio", dar, ':');
|
||||
} else {
|
||||
print_str_opt("sample_aspect_ratio", "N/A");
|
||||
print_str_opt("display_aspect_ratio", "N/A");
|
||||
}
|
||||
s = av_get_pix_fmt_name(par->format);
|
||||
if (s) print_str ("pix_fmt", s);
|
||||
else print_str_opt("pix_fmt", "unknown");
|
||||
print_int("level", par->level);
|
||||
if (par->color_range != AVCOL_RANGE_UNSPECIFIED)
|
||||
print_str ("color_range", av_color_range_name(par->color_range));
|
||||
else
|
||||
print_str_opt("color_range", "N/A");
|
||||
print_int("has_b_frames", dec_ctx->has_b_frames);
|
||||
sar = av_guess_sample_aspect_ratio(fmt_ctx, stream, NULL);
|
||||
if (sar.den) {
|
||||
print_q("sample_aspect_ratio", sar, ':');
|
||||
av_reduce(&dar.num, &dar.den,
|
||||
dec_ctx->width * sar.num,
|
||||
dec_ctx->height * sar.den,
|
||||
1024*1024);
|
||||
print_q("display_aspect_ratio", dar, ':');
|
||||
} else {
|
||||
print_str_opt("sample_aspect_ratio", "N/A");
|
||||
print_str_opt("display_aspect_ratio", "N/A");
|
||||
}
|
||||
s = av_get_pix_fmt_name(dec_ctx->pix_fmt);
|
||||
if (s) print_str ("pix_fmt", s);
|
||||
else print_str_opt("pix_fmt", "unknown");
|
||||
print_int("level", dec_ctx->level);
|
||||
if (dec_ctx->color_range != AVCOL_RANGE_UNSPECIFIED)
|
||||
print_str ("color_range", av_color_range_name(dec_ctx->color_range));
|
||||
else
|
||||
print_str_opt("color_range", "N/A");
|
||||
s = av_get_colorspace_name(dec_ctx->colorspace);
|
||||
if (s) print_str ("color_space", s);
|
||||
else print_str_opt("color_space", "unknown");
|
||||
|
||||
s = av_get_colorspace_name(par->color_space);
|
||||
if (s) print_str ("color_space", s);
|
||||
else print_str_opt("color_space", "unknown");
|
||||
if (dec_ctx->color_trc != AVCOL_TRC_UNSPECIFIED)
|
||||
print_str("color_transfer", av_color_transfer_name(dec_ctx->color_trc));
|
||||
else
|
||||
print_str_opt("color_transfer", av_color_transfer_name(dec_ctx->color_trc));
|
||||
|
||||
if (par->color_trc != AVCOL_TRC_UNSPECIFIED)
|
||||
print_str("color_transfer", av_color_transfer_name(par->color_trc));
|
||||
else
|
||||
print_str_opt("color_transfer", av_color_transfer_name(par->color_trc));
|
||||
if (dec_ctx->color_primaries != AVCOL_PRI_UNSPECIFIED)
|
||||
print_str("color_primaries", av_color_primaries_name(dec_ctx->color_primaries));
|
||||
else
|
||||
print_str_opt("color_primaries", av_color_primaries_name(dec_ctx->color_primaries));
|
||||
|
||||
if (par->color_primaries != AVCOL_PRI_UNSPECIFIED)
|
||||
print_str("color_primaries", av_color_primaries_name(par->color_primaries));
|
||||
else
|
||||
print_str_opt("color_primaries", av_color_primaries_name(par->color_primaries));
|
||||
|
||||
if (par->chroma_location != AVCHROMA_LOC_UNSPECIFIED)
|
||||
print_str("chroma_location", av_chroma_location_name(par->chroma_location));
|
||||
else
|
||||
print_str_opt("chroma_location", av_chroma_location_name(par->chroma_location));
|
||||
|
||||
if (par->field_order == AV_FIELD_PROGRESSIVE)
|
||||
print_str("field_order", "progressive");
|
||||
else if (par->field_order == AV_FIELD_TT)
|
||||
print_str("field_order", "tt");
|
||||
else if (par->field_order == AV_FIELD_BB)
|
||||
print_str("field_order", "bb");
|
||||
else if (par->field_order == AV_FIELD_TB)
|
||||
print_str("field_order", "tb");
|
||||
else if (par->field_order == AV_FIELD_BT)
|
||||
print_str("field_order", "bt");
|
||||
else
|
||||
print_str_opt("field_order", "unknown");
|
||||
if (dec_ctx->chroma_sample_location != AVCHROMA_LOC_UNSPECIFIED)
|
||||
print_str("chroma_location", av_chroma_location_name(dec_ctx->chroma_sample_location));
|
||||
else
|
||||
print_str_opt("chroma_location", av_chroma_location_name(dec_ctx->chroma_sample_location));
|
||||
|
||||
#if FF_API_PRIVATE_OPT
|
||||
if (dec_ctx && dec_ctx->timecode_frame_start >= 0) {
|
||||
char tcbuf[AV_TIMECODE_STR_SIZE];
|
||||
av_timecode_make_mpeg_tc_string(tcbuf, dec_ctx->timecode_frame_start);
|
||||
print_str("timecode", tcbuf);
|
||||
} else {
|
||||
print_str_opt("timecode", "N/A");
|
||||
}
|
||||
if (dec_ctx->timecode_frame_start >= 0) {
|
||||
char tcbuf[AV_TIMECODE_STR_SIZE];
|
||||
av_timecode_make_mpeg_tc_string(tcbuf, dec_ctx->timecode_frame_start);
|
||||
print_str("timecode", tcbuf);
|
||||
} else {
|
||||
print_str_opt("timecode", "N/A");
|
||||
}
|
||||
#endif
|
||||
if (dec_ctx)
|
||||
print_int("refs", dec_ctx->refs);
|
||||
break;
|
||||
break;
|
||||
|
||||
case AVMEDIA_TYPE_AUDIO:
|
||||
s = av_get_sample_fmt_name(par->format);
|
||||
if (s) print_str ("sample_fmt", s);
|
||||
else print_str_opt("sample_fmt", "unknown");
|
||||
print_val("sample_rate", par->sample_rate, unit_hertz_str);
|
||||
print_int("channels", par->channels);
|
||||
case AVMEDIA_TYPE_AUDIO:
|
||||
s = av_get_sample_fmt_name(dec_ctx->sample_fmt);
|
||||
if (s) print_str ("sample_fmt", s);
|
||||
else print_str_opt("sample_fmt", "unknown");
|
||||
print_val("sample_rate", dec_ctx->sample_rate, unit_hertz_str);
|
||||
print_int("channels", dec_ctx->channels);
|
||||
|
||||
if (par->channel_layout) {
|
||||
av_bprint_clear(&pbuf);
|
||||
av_bprint_channel_layout(&pbuf, par->channels, par->channel_layout);
|
||||
print_str ("channel_layout", pbuf.str);
|
||||
} else {
|
||||
print_str_opt("channel_layout", "unknown");
|
||||
if (dec_ctx->channel_layout) {
|
||||
av_bprint_clear(&pbuf);
|
||||
av_bprint_channel_layout(&pbuf, dec_ctx->channels, dec_ctx->channel_layout);
|
||||
print_str ("channel_layout", pbuf.str);
|
||||
} else {
|
||||
print_str_opt("channel_layout", "unknown");
|
||||
}
|
||||
|
||||
print_int("bits_per_sample", av_get_bits_per_sample(dec_ctx->codec_id));
|
||||
break;
|
||||
|
||||
case AVMEDIA_TYPE_SUBTITLE:
|
||||
if (dec_ctx->width)
|
||||
print_int("width", dec_ctx->width);
|
||||
else
|
||||
print_str_opt("width", "N/A");
|
||||
if (dec_ctx->height)
|
||||
print_int("height", dec_ctx->height);
|
||||
else
|
||||
print_str_opt("height", "N/A");
|
||||
break;
|
||||
}
|
||||
|
||||
print_int("bits_per_sample", av_get_bits_per_sample(par->codec_id));
|
||||
break;
|
||||
|
||||
case AVMEDIA_TYPE_SUBTITLE:
|
||||
if (par->width)
|
||||
print_int("width", par->width);
|
||||
else
|
||||
print_str_opt("width", "N/A");
|
||||
if (par->height)
|
||||
print_int("height", par->height);
|
||||
else
|
||||
print_str_opt("height", "N/A");
|
||||
break;
|
||||
} else {
|
||||
print_str_opt("codec_type", "unknown");
|
||||
}
|
||||
|
||||
if (dec_ctx && dec_ctx->codec && dec_ctx->codec->priv_class && show_private_data) {
|
||||
if (dec_ctx->codec && dec_ctx->codec->priv_class && show_private_data) {
|
||||
const AVOption *opt = NULL;
|
||||
while (opt = av_opt_next(dec_ctx->priv_data,opt)) {
|
||||
uint8_t *str;
|
||||
@@ -2345,14 +2296,12 @@ static int show_stream(WriterContext *w, AVFormatContext *fmt_ctx, int stream_id
|
||||
print_time("start_time", stream->start_time, &stream->time_base);
|
||||
print_ts ("duration_ts", stream->duration);
|
||||
print_time("duration", stream->duration, &stream->time_base);
|
||||
if (par->bit_rate > 0) print_val ("bit_rate", par->bit_rate, unit_bit_per_second_str);
|
||||
if (dec_ctx->bit_rate > 0) print_val ("bit_rate", dec_ctx->bit_rate, unit_bit_per_second_str);
|
||||
else print_str_opt("bit_rate", "N/A");
|
||||
#if FF_API_LAVF_AVCTX
|
||||
if (stream->codec->rc_max_rate > 0) print_val ("max_bit_rate", stream->codec->rc_max_rate, unit_bit_per_second_str);
|
||||
else print_str_opt("max_bit_rate", "N/A");
|
||||
#endif
|
||||
if (dec_ctx && dec_ctx->bits_per_raw_sample > 0) print_fmt("bits_per_raw_sample", "%d", dec_ctx->bits_per_raw_sample);
|
||||
else print_str_opt("bits_per_raw_sample", "N/A");
|
||||
if (dec_ctx->rc_max_rate > 0) print_val ("max_bit_rate", dec_ctx->rc_max_rate, unit_bit_per_second_str);
|
||||
else print_str_opt("max_bit_rate", "N/A");
|
||||
if (dec_ctx->bits_per_raw_sample > 0) print_fmt("bits_per_raw_sample", "%d", dec_ctx->bits_per_raw_sample);
|
||||
else print_str_opt("bits_per_raw_sample", "N/A");
|
||||
if (stream->nb_frames) print_fmt ("nb_frames", "%"PRId64, stream->nb_frames);
|
||||
else print_str_opt("nb_frames", "N/A");
|
||||
if (nb_streams_frames[stream_idx]) print_fmt ("nb_read_frames", "%"PRIu64, nb_streams_frames[stream_idx]);
|
||||
@@ -2360,10 +2309,10 @@ static int show_stream(WriterContext *w, AVFormatContext *fmt_ctx, int stream_id
|
||||
if (nb_streams_packets[stream_idx]) print_fmt ("nb_read_packets", "%"PRIu64, nb_streams_packets[stream_idx]);
|
||||
else print_str_opt("nb_read_packets", "N/A");
|
||||
if (do_show_data)
|
||||
writer_print_data(w, "extradata", par->extradata,
|
||||
par->extradata_size);
|
||||
writer_print_data_hash(w, "extradata_hash", par->extradata,
|
||||
par->extradata_size);
|
||||
writer_print_data(w, "extradata", dec_ctx->extradata,
|
||||
dec_ctx->extradata_size);
|
||||
writer_print_data_hash(w, "extradata_hash", dec_ctx->extradata,
|
||||
dec_ctx->extradata_size);
|
||||
|
||||
/* Print disposition information */
|
||||
#define PRINT_DISPOSITION(flagname, name) do { \
|
||||
@@ -2383,7 +2332,6 @@ static int show_stream(WriterContext *w, AVFormatContext *fmt_ctx, int stream_id
|
||||
PRINT_DISPOSITION(VISUAL_IMPAIRED, "visual_impaired");
|
||||
PRINT_DISPOSITION(CLEAN_EFFECTS, "clean_effects");
|
||||
PRINT_DISPOSITION(ATTACHED_PIC, "attached_pic");
|
||||
PRINT_DISPOSITION(TIMED_THUMBNAILS, "timed_thumbnails");
|
||||
writer_print_section_footer(w);
|
||||
}
|
||||
|
||||
@@ -2391,9 +2339,22 @@ static int show_stream(WriterContext *w, AVFormatContext *fmt_ctx, int stream_id
|
||||
ret = show_tags(w, stream->metadata, in_program ? SECTION_ID_PROGRAM_STREAM_TAGS : SECTION_ID_STREAM_TAGS);
|
||||
|
||||
if (stream->nb_side_data) {
|
||||
print_pkt_side_data(w, stream->side_data, stream->nb_side_data,
|
||||
SECTION_ID_STREAM_SIDE_DATA_LIST,
|
||||
SECTION_ID_STREAM_SIDE_DATA);
|
||||
int i;
|
||||
writer_print_section_header(w, SECTION_ID_STREAM_SIDE_DATA_LIST);
|
||||
for (i = 0; i < stream->nb_side_data; i++) {
|
||||
AVPacketSideData *sd = &stream->side_data[i];
|
||||
const char *name = av_packet_side_data_name(sd->type);
|
||||
|
||||
writer_print_section_header(w, SECTION_ID_STREAM_SIDE_DATA);
|
||||
print_str("side_data_type", name ? name : "unknown");
|
||||
print_int("side_data_size", sd->size);
|
||||
if (sd->type == AV_PKT_DATA_DISPLAYMATRIX && sd->size >= 9*4) {
|
||||
writer_print_integers(w, "displaymatrix", sd->data, 9, " %11d", 3, 4, 1);
|
||||
print_int("rotation", av_display_rotation_get((int32_t *)sd->data));
|
||||
}
|
||||
writer_print_section_footer(w);
|
||||
}
|
||||
writer_print_section_footer(w);
|
||||
}
|
||||
|
||||
writer_print_section_footer(w);
|
||||
@@ -2403,15 +2364,14 @@ static int show_stream(WriterContext *w, AVFormatContext *fmt_ctx, int stream_id
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int show_streams(WriterContext *w, InputFile *ifile)
|
||||
static int show_streams(WriterContext *w, AVFormatContext *fmt_ctx)
|
||||
{
|
||||
AVFormatContext *fmt_ctx = ifile->fmt_ctx;
|
||||
int i, ret = 0;
|
||||
|
||||
writer_print_section_header(w, SECTION_ID_STREAMS);
|
||||
for (i = 0; i < ifile->nb_streams; i++)
|
||||
for (i = 0; i < fmt_ctx->nb_streams; i++)
|
||||
if (selected_streams[i]) {
|
||||
ret = show_stream(w, fmt_ctx, i, &ifile->streams[i], 0);
|
||||
ret = show_stream(w, fmt_ctx, i, 0);
|
||||
if (ret < 0)
|
||||
break;
|
||||
}
|
||||
@@ -2420,9 +2380,8 @@ static int show_streams(WriterContext *w, InputFile *ifile)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int show_program(WriterContext *w, InputFile *ifile, AVProgram *program)
|
||||
static int show_program(WriterContext *w, AVFormatContext *fmt_ctx, AVProgram *program)
|
||||
{
|
||||
AVFormatContext *fmt_ctx = ifile->fmt_ctx;
|
||||
int i, ret = 0;
|
||||
|
||||
writer_print_section_header(w, SECTION_ID_PROGRAM);
|
||||
@@ -2443,7 +2402,7 @@ static int show_program(WriterContext *w, InputFile *ifile, AVProgram *program)
|
||||
writer_print_section_header(w, SECTION_ID_PROGRAM_STREAMS);
|
||||
for (i = 0; i < program->nb_stream_indexes; i++) {
|
||||
if (selected_streams[program->stream_index[i]]) {
|
||||
ret = show_stream(w, fmt_ctx, program->stream_index[i], &ifile->streams[program->stream_index[i]], 1);
|
||||
ret = show_stream(w, fmt_ctx, program->stream_index[i], 1);
|
||||
if (ret < 0)
|
||||
break;
|
||||
}
|
||||
@@ -2455,9 +2414,8 @@ end:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int show_programs(WriterContext *w, InputFile *ifile)
|
||||
static int show_programs(WriterContext *w, AVFormatContext *fmt_ctx)
|
||||
{
|
||||
AVFormatContext *fmt_ctx = ifile->fmt_ctx;
|
||||
int i, ret = 0;
|
||||
|
||||
writer_print_section_header(w, SECTION_ID_PROGRAMS);
|
||||
@@ -2465,7 +2423,7 @@ static int show_programs(WriterContext *w, InputFile *ifile)
|
||||
AVProgram *program = fmt_ctx->programs[i];
|
||||
if (!program)
|
||||
continue;
|
||||
ret = show_program(w, ifile, program);
|
||||
ret = show_program(w, fmt_ctx, program);
|
||||
if (ret < 0)
|
||||
break;
|
||||
}
|
||||
@@ -2473,9 +2431,8 @@ static int show_programs(WriterContext *w, InputFile *ifile)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int show_chapters(WriterContext *w, InputFile *ifile)
|
||||
static int show_chapters(WriterContext *w, AVFormatContext *fmt_ctx)
|
||||
{
|
||||
AVFormatContext *fmt_ctx = ifile->fmt_ctx;
|
||||
int i, ret = 0;
|
||||
|
||||
writer_print_section_header(w, SECTION_ID_CHAPTERS);
|
||||
@@ -2498,9 +2455,8 @@ static int show_chapters(WriterContext *w, InputFile *ifile)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int show_format(WriterContext *w, InputFile *ifile)
|
||||
static int show_format(WriterContext *w, AVFormatContext *fmt_ctx)
|
||||
{
|
||||
AVFormatContext *fmt_ctx = ifile->fmt_ctx;
|
||||
char val_str[128];
|
||||
int64_t size = fmt_ctx->pb ? avio_size(fmt_ctx->pb) : -1;
|
||||
int ret = 0;
|
||||
@@ -2543,7 +2499,7 @@ static void show_error(WriterContext *w, int err)
|
||||
writer_print_section_footer(w);
|
||||
}
|
||||
|
||||
static int open_input_file(InputFile *ifile, const char *filename)
|
||||
static int open_input_file(AVFormatContext **fmt_ctx_ptr, const char *filename)
|
||||
{
|
||||
int err, i, orig_nb_streams;
|
||||
AVFormatContext *fmt_ctx = NULL;
|
||||
@@ -2560,7 +2516,7 @@ static int open_input_file(InputFile *ifile, const char *filename)
|
||||
print_error(filename, err);
|
||||
return err;
|
||||
}
|
||||
ifile->fmt_ctx = fmt_ctx;
|
||||
*fmt_ctx_ptr = fmt_ctx;
|
||||
if (scan_all_pmts_set)
|
||||
av_dict_set(&format_opts, "scan_all_pmts", NULL, AV_DICT_MATCH_CASE);
|
||||
if ((t = av_dict_get(format_opts, "", NULL, AV_DICT_IGNORE_SUFFIX))) {
|
||||
@@ -2585,55 +2541,26 @@ static int open_input_file(InputFile *ifile, const char *filename)
|
||||
|
||||
av_dump_format(fmt_ctx, 0, filename, 0);
|
||||
|
||||
ifile->streams = av_mallocz_array(fmt_ctx->nb_streams,
|
||||
sizeof(*ifile->streams));
|
||||
if (!ifile->streams)
|
||||
exit(1);
|
||||
ifile->nb_streams = fmt_ctx->nb_streams;
|
||||
|
||||
/* bind a decoder to each input stream */
|
||||
for (i = 0; i < fmt_ctx->nb_streams; i++) {
|
||||
InputStream *ist = &ifile->streams[i];
|
||||
AVStream *stream = fmt_ctx->streams[i];
|
||||
AVCodec *codec;
|
||||
|
||||
ist->st = stream;
|
||||
|
||||
if (stream->codecpar->codec_id == AV_CODEC_ID_PROBE) {
|
||||
if (stream->codec->codec_id == AV_CODEC_ID_PROBE) {
|
||||
av_log(NULL, AV_LOG_WARNING,
|
||||
"Failed to probe codec for input stream %d\n",
|
||||
stream->index);
|
||||
continue;
|
||||
}
|
||||
|
||||
codec = avcodec_find_decoder(stream->codecpar->codec_id);
|
||||
if (!codec) {
|
||||
} else if (!(codec = avcodec_find_decoder(stream->codec->codec_id))) {
|
||||
av_log(NULL, AV_LOG_WARNING,
|
||||
"Unsupported codec with id %d for input stream %d\n",
|
||||
stream->codecpar->codec_id, stream->index);
|
||||
continue;
|
||||
}
|
||||
{
|
||||
AVDictionary *opts = filter_codec_opts(codec_opts, stream->codecpar->codec_id,
|
||||
stream->codec->codec_id, stream->index);
|
||||
} else {
|
||||
AVDictionary *opts = filter_codec_opts(codec_opts, stream->codec->codec_id,
|
||||
fmt_ctx, stream, codec);
|
||||
|
||||
ist->dec_ctx = avcodec_alloc_context3(codec);
|
||||
if (!ist->dec_ctx)
|
||||
exit(1);
|
||||
|
||||
err = avcodec_parameters_to_context(ist->dec_ctx, stream->codecpar);
|
||||
if (err < 0)
|
||||
exit(1);
|
||||
|
||||
av_codec_set_pkt_timebase(ist->dec_ctx, stream->time_base);
|
||||
ist->dec_ctx->framerate = stream->avg_frame_rate;
|
||||
|
||||
if (avcodec_open2(ist->dec_ctx, codec, &opts) < 0) {
|
||||
if (avcodec_open2(stream->codec, codec, &opts) < 0) {
|
||||
av_log(NULL, AV_LOG_WARNING, "Could not open codec for input stream %d\n",
|
||||
stream->index);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if ((t = av_dict_get(opts, "", NULL, AV_DICT_IGNORE_SUFFIX))) {
|
||||
av_log(NULL, AV_LOG_ERROR, "Option %s for input stream %d not found\n",
|
||||
t->key, stream->index);
|
||||
@@ -2642,49 +2569,47 @@ static int open_input_file(InputFile *ifile, const char *filename)
|
||||
}
|
||||
}
|
||||
|
||||
ifile->fmt_ctx = fmt_ctx;
|
||||
*fmt_ctx_ptr = fmt_ctx;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void close_input_file(InputFile *ifile)
|
||||
static void close_input_file(AVFormatContext **ctx_ptr)
|
||||
{
|
||||
int i;
|
||||
AVFormatContext *fmt_ctx = *ctx_ptr;
|
||||
|
||||
/* close decoder for each stream */
|
||||
for (i = 0; i < ifile->nb_streams; i++)
|
||||
if (ifile->streams[i].st->codecpar->codec_id != AV_CODEC_ID_NONE)
|
||||
avcodec_free_context(&ifile->streams[i].dec_ctx);
|
||||
for (i = 0; i < fmt_ctx->nb_streams; i++)
|
||||
if (fmt_ctx->streams[i]->codec->codec_id != AV_CODEC_ID_NONE)
|
||||
avcodec_close(fmt_ctx->streams[i]->codec);
|
||||
|
||||
av_freep(&ifile->streams);
|
||||
ifile->nb_streams = 0;
|
||||
|
||||
avformat_close_input(&ifile->fmt_ctx);
|
||||
avformat_close_input(ctx_ptr);
|
||||
}
|
||||
|
||||
static int probe_file(WriterContext *wctx, const char *filename)
|
||||
{
|
||||
InputFile ifile = { 0 };
|
||||
AVFormatContext *fmt_ctx = NULL;
|
||||
int ret, i;
|
||||
int section_id;
|
||||
|
||||
do_read_frames = do_show_frames || do_count_frames;
|
||||
do_read_packets = do_show_packets || do_count_packets;
|
||||
|
||||
ret = open_input_file(&ifile, filename);
|
||||
ret = open_input_file(&fmt_ctx, filename);
|
||||
if (ret < 0)
|
||||
goto end;
|
||||
|
||||
#define CHECK_END if (ret < 0) goto end
|
||||
|
||||
nb_streams = ifile.fmt_ctx->nb_streams;
|
||||
REALLOCZ_ARRAY_STREAM(nb_streams_frames,0,ifile.fmt_ctx->nb_streams);
|
||||
REALLOCZ_ARRAY_STREAM(nb_streams_packets,0,ifile.fmt_ctx->nb_streams);
|
||||
REALLOCZ_ARRAY_STREAM(selected_streams,0,ifile.fmt_ctx->nb_streams);
|
||||
nb_streams = fmt_ctx->nb_streams;
|
||||
REALLOCZ_ARRAY_STREAM(nb_streams_frames,0,fmt_ctx->nb_streams);
|
||||
REALLOCZ_ARRAY_STREAM(nb_streams_packets,0,fmt_ctx->nb_streams);
|
||||
REALLOCZ_ARRAY_STREAM(selected_streams,0,fmt_ctx->nb_streams);
|
||||
|
||||
for (i = 0; i < ifile.fmt_ctx->nb_streams; i++) {
|
||||
for (i = 0; i < fmt_ctx->nb_streams; i++) {
|
||||
if (stream_specifier) {
|
||||
ret = avformat_match_stream_specifier(ifile.fmt_ctx,
|
||||
ifile.fmt_ctx->streams[i],
|
||||
ret = avformat_match_stream_specifier(fmt_ctx,
|
||||
fmt_ctx->streams[i],
|
||||
stream_specifier);
|
||||
CHECK_END;
|
||||
else
|
||||
@@ -2705,33 +2630,33 @@ static int probe_file(WriterContext *wctx, const char *filename)
|
||||
section_id = SECTION_ID_FRAMES;
|
||||
if (do_show_frames || do_show_packets)
|
||||
writer_print_section_header(wctx, section_id);
|
||||
ret = read_packets(wctx, &ifile);
|
||||
ret = read_packets(wctx, fmt_ctx);
|
||||
if (do_show_frames || do_show_packets)
|
||||
writer_print_section_footer(wctx);
|
||||
CHECK_END;
|
||||
}
|
||||
|
||||
if (do_show_programs) {
|
||||
ret = show_programs(wctx, &ifile);
|
||||
ret = show_programs(wctx, fmt_ctx);
|
||||
CHECK_END;
|
||||
}
|
||||
|
||||
if (do_show_streams) {
|
||||
ret = show_streams(wctx, &ifile);
|
||||
ret = show_streams(wctx, fmt_ctx);
|
||||
CHECK_END;
|
||||
}
|
||||
if (do_show_chapters) {
|
||||
ret = show_chapters(wctx, &ifile);
|
||||
ret = show_chapters(wctx, fmt_ctx);
|
||||
CHECK_END;
|
||||
}
|
||||
if (do_show_format) {
|
||||
ret = show_format(wctx, &ifile);
|
||||
ret = show_format(wctx, fmt_ctx);
|
||||
CHECK_END;
|
||||
}
|
||||
|
||||
end:
|
||||
if (ifile.fmt_ctx)
|
||||
close_input_file(&ifile);
|
||||
if (fmt_ctx)
|
||||
close_input_file(&fmt_ctx);
|
||||
av_freep(&nb_streams_frames);
|
||||
av_freep(&nb_streams_packets);
|
||||
av_freep(&selected_streams);
|
||||
@@ -3253,8 +3178,6 @@ int main(int argc, char **argv)
|
||||
char *w_name = NULL, *w_args = NULL;
|
||||
int ret, i;
|
||||
|
||||
init_dynload();
|
||||
|
||||
av_log_set_flags(AV_LOG_SKIP_REPEATED);
|
||||
register_exit(ffprobe_cleanup);
|
||||
|
||||
@@ -3291,7 +3214,6 @@ int main(int argc, char **argv)
|
||||
SET_DO_SHOW(FRAME_TAGS, frame_tags);
|
||||
SET_DO_SHOW(PROGRAM_TAGS, program_tags);
|
||||
SET_DO_SHOW(STREAM_TAGS, stream_tags);
|
||||
SET_DO_SHOW(PROGRAM_STREAM_TAGS, stream_tags);
|
||||
SET_DO_SHOW(PACKET_TAGS, packet_tags);
|
||||
|
||||
if (do_bitexact && (do_show_program_version || do_show_library_versions)) {
|
||||
|
||||
20
ffserver.c
20
ffserver.c
@@ -373,8 +373,8 @@ static void ffm_set_write_index(AVFormatContext *s, int64_t pos,
|
||||
int64_t file_size)
|
||||
{
|
||||
av_opt_set_int(s, "server_attached", 1, AV_OPT_SEARCH_CHILDREN);
|
||||
av_opt_set_int(s, "ffm_write_index", pos, AV_OPT_SEARCH_CHILDREN);
|
||||
av_opt_set_int(s, "ffm_file_size", file_size, AV_OPT_SEARCH_CHILDREN);
|
||||
av_opt_set_int(s, "write_index", pos, AV_OPT_SEARCH_CHILDREN);
|
||||
av_opt_set_int(s, "file_size", file_size, AV_OPT_SEARCH_CHILDREN);
|
||||
}
|
||||
|
||||
static char *ctime1(char *buf2, size_t buf_size)
|
||||
@@ -2622,7 +2622,6 @@ static int http_start_receive_data(HTTPContext *c)
|
||||
{
|
||||
int fd;
|
||||
int ret;
|
||||
int64_t ret64;
|
||||
|
||||
if (c->stream->feed_opened) {
|
||||
http_log("Stream feed '%s' was not opened\n",
|
||||
@@ -2658,13 +2657,13 @@ static int http_start_receive_data(HTTPContext *c)
|
||||
return ret;
|
||||
}
|
||||
} else {
|
||||
ret64 = ffm_read_write_index(fd);
|
||||
if (ret64 < 0) {
|
||||
ret = ffm_read_write_index(fd);
|
||||
if (ret < 0) {
|
||||
http_log("Error reading write index from feed file '%s': %s\n",
|
||||
c->stream->feed_filename, strerror(errno));
|
||||
return ret64;
|
||||
return ret;
|
||||
}
|
||||
c->stream->feed_write_index = ret64;
|
||||
c->stream->feed_write_index = ret;
|
||||
}
|
||||
|
||||
c->stream->feed_write_index = FFMAX(ffm_read_write_index(fd),
|
||||
@@ -2996,8 +2995,6 @@ static int prepare_sdp_description(FFServerStream *stream, uint8_t **pbuffer,
|
||||
for(i = 0; i < stream->nb_streams; i++) {
|
||||
avc->streams[i] = &avs[i];
|
||||
avc->streams[i]->codec = stream->streams[i]->codec;
|
||||
avcodec_parameters_from_context(stream->streams[i]->codecpar, stream->streams[i]->codec);
|
||||
avc->streams[i]->codecpar = stream->streams[i]->codecpar;
|
||||
}
|
||||
*pbuffer = av_mallocz(2048);
|
||||
if (!*pbuffer)
|
||||
@@ -3538,8 +3535,6 @@ static AVStream *add_av_stream1(FFServerStream *stream,
|
||||
|
||||
fst->priv_data = av_mallocz(sizeof(FeedData));
|
||||
fst->internal = av_mallocz(sizeof(*fst->internal));
|
||||
fst->internal->avctx = avcodec_alloc_context3(NULL);
|
||||
fst->codecpar = avcodec_parameters_alloc();
|
||||
fst->index = stream->nb_streams;
|
||||
avpriv_set_pts_info(fst, 33, 1, 90000);
|
||||
fst->sample_aspect_ratio = codec->sample_aspect_ratio;
|
||||
@@ -3863,8 +3858,6 @@ drop:
|
||||
if (avformat_write_header(s, NULL) < 0) {
|
||||
http_log("Container doesn't support the required parameters\n");
|
||||
avio_closep(&s->pb);
|
||||
s->streams = NULL;
|
||||
s->nb_streams = 0;
|
||||
avformat_free_context(s);
|
||||
goto bail;
|
||||
}
|
||||
@@ -3980,7 +3973,6 @@ int main(int argc, char **argv)
|
||||
int cfg_parsed;
|
||||
int ret = EXIT_FAILURE;
|
||||
|
||||
init_dynload();
|
||||
|
||||
config.filename = av_strdup("/etc/ffserver.conf");
|
||||
|
||||
|
||||
@@ -1138,8 +1138,6 @@ static int ffserver_parse_config_stream(FFServerConfig *config, const char *cmd,
|
||||
av_dict_free(&config->audio_opts);
|
||||
avcodec_free_context(&config->dummy_vctx);
|
||||
avcodec_free_context(&config->dummy_actx);
|
||||
config->no_video = 0;
|
||||
config->no_audio = 0;
|
||||
*pstream = NULL;
|
||||
} else if (!av_strcasecmp(cmd, "File") ||
|
||||
!av_strcasecmp(cmd, "ReadOnlyFile")) {
|
||||
|
||||
4
libavcodec/.gitignore
vendored
4
libavcodec/.gitignore
vendored
@@ -1,4 +0,0 @@
|
||||
/*_tablegen
|
||||
/*_tables.c
|
||||
/*_tables.h
|
||||
/bsf_list.c
|
||||
@@ -28,6 +28,7 @@
|
||||
* Supports: PAL8 (RGB 8bpp, paletted)
|
||||
* : BGR24 (RGB 24bpp) (can also output it as RGB32)
|
||||
* : RGB32 (RGB 32bpp, 4th plane is alpha)
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
@@ -41,7 +42,7 @@
|
||||
|
||||
|
||||
static const enum AVPixelFormat pixfmt_rgb24[] = {
|
||||
AV_PIX_FMT_BGR24, AV_PIX_FMT_0RGB32, AV_PIX_FMT_NONE };
|
||||
AV_PIX_FMT_BGR24, AV_PIX_FMT_RGB32, AV_PIX_FMT_NONE };
|
||||
|
||||
typedef struct EightBpsContext {
|
||||
AVCodecContext *avctx;
|
||||
@@ -65,7 +66,6 @@ static int decode_frame(AVCodecContext *avctx, void *data,
|
||||
unsigned int dlen, p, row;
|
||||
const unsigned char *lp, *dp, *ep;
|
||||
unsigned char count;
|
||||
unsigned int px_inc;
|
||||
unsigned int planes = c->planes;
|
||||
unsigned char *planemap = c->planemap;
|
||||
int ret;
|
||||
@@ -78,8 +78,6 @@ static int decode_frame(AVCodecContext *avctx, void *data,
|
||||
/* Set data pointer after line lengths */
|
||||
dp = encoded + planes * (height << 1);
|
||||
|
||||
px_inc = planes + (avctx->pix_fmt == AV_PIX_FMT_0RGB32);
|
||||
|
||||
for (p = 0; p < planes; p++) {
|
||||
/* Lines length pointer for this plane */
|
||||
lp = encoded + p * (height << 1);
|
||||
@@ -98,21 +96,21 @@ static int decode_frame(AVCodecContext *avctx, void *data,
|
||||
if ((count = *dp++) <= 127) {
|
||||
count++;
|
||||
dlen -= count + 1;
|
||||
if (pixptr_end - pixptr < count * px_inc)
|
||||
if (pixptr_end - pixptr < count * planes)
|
||||
break;
|
||||
if (ep - dp < count)
|
||||
return AVERROR_INVALIDDATA;
|
||||
while (count--) {
|
||||
*pixptr = *dp++;
|
||||
pixptr += px_inc;
|
||||
pixptr += planes;
|
||||
}
|
||||
} else {
|
||||
count = 257 - count;
|
||||
if (pixptr_end - pixptr < count * px_inc)
|
||||
if (pixptr_end - pixptr < count * planes)
|
||||
break;
|
||||
while (count--) {
|
||||
*pixptr = *dp;
|
||||
pixptr += px_inc;
|
||||
pixptr += planes;
|
||||
}
|
||||
dp++;
|
||||
dlen -= 2;
|
||||
|
||||
@@ -5,12 +5,10 @@ NAME = avcodec
|
||||
HEADERS = avcodec.h \
|
||||
avdct.h \
|
||||
avfft.h \
|
||||
dv_profile.h \
|
||||
d3d11va.h \
|
||||
dirac.h \
|
||||
dv_profile.h \
|
||||
dxva2.h \
|
||||
jni.h \
|
||||
mediacodec.h \
|
||||
qsv.h \
|
||||
vaapi.h \
|
||||
vda.h \
|
||||
@@ -27,16 +25,12 @@ OBJS = allcodecs.o \
|
||||
avpicture.o \
|
||||
bitstream.o \
|
||||
bitstream_filter.o \
|
||||
bitstream_filters.o \
|
||||
bsf.o \
|
||||
codec_desc.o \
|
||||
d3d11va.o \
|
||||
dirac.o \
|
||||
dv_profile.o \
|
||||
imgconvert.o \
|
||||
jni.o \
|
||||
mathtables.o \
|
||||
mediacodec.o \
|
||||
options.o \
|
||||
parser.o \
|
||||
profiles.o \
|
||||
@@ -84,7 +78,6 @@ OBJS-$(CONFIG_IIRFILTER) += iirfilter.o
|
||||
OBJS-$(CONFIG_IMDCT15) += imdct15.o
|
||||
OBJS-$(CONFIG_INTRAX8) += intrax8.o intrax8dsp.o
|
||||
OBJS-$(CONFIG_IVIDSP) += ivi_dsp.o
|
||||
OBJS-$(CONFIG_JNI) += ffjni.o jni.o
|
||||
OBJS-$(CONFIG_JPEGTABLES) += jpegtables.o
|
||||
OBJS-$(CONFIG_LIBXVID) += libxvid_rc.o
|
||||
OBJS-$(CONFIG_LLAUDDSP) += lossless_audiodsp.o
|
||||
@@ -94,7 +87,6 @@ OBJS-$(CONFIG_LSP) += lsp.o
|
||||
OBJS-$(CONFIG_LZF) += lzf.o
|
||||
OBJS-$(CONFIG_MDCT) += mdct_fixed.o 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 mpegaudiodata.o \
|
||||
mpegaudiodecheader.o
|
||||
@@ -126,8 +118,6 @@ OBJS-$(CONFIG_STARTCODE) += startcode.o
|
||||
OBJS-$(CONFIG_TEXTUREDSP) += texturedsp.o
|
||||
OBJS-$(CONFIG_TEXTUREDSPENC) += texturedspenc.o
|
||||
OBJS-$(CONFIG_TPELDSP) += tpeldsp.o
|
||||
OBJS-$(CONFIG_VAAPI_ENCODE) += vaapi_encode.o
|
||||
OBJS-$(CONFIG_VC1DSP) += vc1dsp.o
|
||||
OBJS-$(CONFIG_VIDEODSP) += videodsp.o
|
||||
OBJS-$(CONFIG_VP3DSP) += vp3dsp.o
|
||||
OBJS-$(CONFIG_VP56DSP) += vp56dsp.o
|
||||
@@ -141,17 +131,17 @@ 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_float.o \
|
||||
aacadtsdec.o mpeg4audio.o kbdwin.o \
|
||||
sbrdsp.o aacpsdsp_float.o cbrt_data.o
|
||||
sbrdsp.o aacpsdsp_float.o
|
||||
OBJS-$(CONFIG_AAC_FIXED_DECODER) += aacdec_fixed.o aactab.o aacsbr_fixed.o aacps_fixed.o \
|
||||
aacadtsdec.o mpeg4audio.o kbdwin.o \
|
||||
sbrdsp_fixed.o aacpsdsp_fixed.o cbrt_data_fixed.o
|
||||
sbrdsp_fixed.o aacpsdsp_fixed.o
|
||||
OBJS-$(CONFIG_AAC_ENCODER) += aacenc.o aaccoder.o aacenctab.o \
|
||||
aacpsy.o aactab.o \
|
||||
aacenc_is.o \
|
||||
aacenc_tns.o \
|
||||
aacenc_ltp.o \
|
||||
aacenc_pred.o \
|
||||
psymodel.o mpeg4audio.o kbdwin.o cbrt_data.o
|
||||
psymodel.o mpeg4audio.o kbdwin.o
|
||||
OBJS-$(CONFIG_AASC_DECODER) += aasc.o msrledec.o
|
||||
OBJS-$(CONFIG_AC3_DECODER) += ac3dec_float.o ac3dec_data.o ac3.o kbdwin.o
|
||||
OBJS-$(CONFIG_AC3_FIXED_DECODER) += ac3dec_fixed.o ac3dec_data.o ac3.o kbdwin.o
|
||||
@@ -163,7 +153,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 mpeg4audio.o
|
||||
OBJS-$(CONFIG_AMRNB_DECODER) += amrnbdec.o celp_filters.o \
|
||||
celp_math.o acelp_filters.o \
|
||||
acelp_vectors.o \
|
||||
@@ -181,9 +171,9 @@ OBJS-$(CONFIG_ANSI_DECODER) += ansi.o cga_data.o
|
||||
OBJS-$(CONFIG_APE_DECODER) += apedec.o
|
||||
OBJS-$(CONFIG_APNG_DECODER) += png.o pngdec.o pngdsp.o
|
||||
OBJS-$(CONFIG_APNG_ENCODER) += png.o pngenc.o
|
||||
OBJS-$(CONFIG_SSA_DECODER) += assdec.o ass.o
|
||||
OBJS-$(CONFIG_SSA_DECODER) += assdec.o ass.o ass_split.o
|
||||
OBJS-$(CONFIG_SSA_ENCODER) += assenc.o ass.o
|
||||
OBJS-$(CONFIG_ASS_DECODER) += assdec.o ass.o
|
||||
OBJS-$(CONFIG_ASS_DECODER) += assdec.o ass.o ass_split.o
|
||||
OBJS-$(CONFIG_ASS_ENCODER) += assenc.o ass.o
|
||||
OBJS-$(CONFIG_ASV1_DECODER) += asvdec.o asv.o mpeg12data.o
|
||||
OBJS-$(CONFIG_ASV1_ENCODER) += asvenc.o asv.o mpeg12data.o
|
||||
@@ -226,33 +216,31 @@ OBJS-$(CONFIG_CINEPAK_ENCODER) += cinepakenc.o elbg.o
|
||||
OBJS-$(CONFIG_CLJR_DECODER) += cljrdec.o
|
||||
OBJS-$(CONFIG_CLJR_ENCODER) += cljrenc.o
|
||||
OBJS-$(CONFIG_CLLC_DECODER) += cllc.o canopus.o
|
||||
OBJS-$(CONFIG_COOK_DECODER) += cook.o
|
||||
OBJS-$(CONFIG_COMFORTNOISE_DECODER) += cngdec.o celp_filters.o
|
||||
OBJS-$(CONFIG_COMFORTNOISE_ENCODER) += cngenc.o
|
||||
OBJS-$(CONFIG_COOK_DECODER) += cook.o
|
||||
OBJS-$(CONFIG_CPIA_DECODER) += cpia.o
|
||||
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 \
|
||||
OBJS-$(CONFIG_DCA_DECODER) += dcadec.o dca.o dcadata.o \
|
||||
dca_core.o dca_exss.o dca_xll.o \
|
||||
dcadsp.o dcadct.o synth_filter.o
|
||||
OBJS-$(CONFIG_DCA_ENCODER) += dcaenc.o dca.o dcadata.o
|
||||
OBJS-$(CONFIG_DDS_DECODER) += dds.o
|
||||
OBJS-$(CONFIG_DIRAC_DECODER) += diracdec.o dirac.o diracdsp.o diractab.o \
|
||||
dirac_arith.o mpeg12data.o dirac_dwt.o \
|
||||
dirac_vlc.o
|
||||
dirac_arith.o mpeg12data.o dirac_dwt.o
|
||||
OBJS-$(CONFIG_DFA_DECODER) += dfa.o
|
||||
OBJS-$(CONFIG_DNXHD_DECODER) += dnxhddec.o dnxhddata.o
|
||||
OBJS-$(CONFIG_DNXHD_ENCODER) += dnxhdenc.o dnxhddata.o
|
||||
OBJS-$(CONFIG_DPX_DECODER) += dpx.o
|
||||
OBJS-$(CONFIG_DPX_ENCODER) += dpxenc.o
|
||||
OBJS-$(CONFIG_DSD_LSBF_DECODER) += dsddec.o dsd.o
|
||||
OBJS-$(CONFIG_DSD_MSBF_DECODER) += dsddec.o dsd.o
|
||||
OBJS-$(CONFIG_DSD_LSBF_PLANAR_DECODER) += dsddec.o dsd.o
|
||||
OBJS-$(CONFIG_DSD_MSBF_PLANAR_DECODER) += dsddec.o dsd.o
|
||||
OBJS-$(CONFIG_DSD_LSBF_DECODER) += dsddec.o
|
||||
OBJS-$(CONFIG_DSD_MSBF_DECODER) += dsddec.o
|
||||
OBJS-$(CONFIG_DSD_LSBF_PLANAR_DECODER) += dsddec.o
|
||||
OBJS-$(CONFIG_DSD_MSBF_PLANAR_DECODER) += dsddec.o
|
||||
OBJS-$(CONFIG_DSICINAUDIO_DECODER) += dsicinaudio.o
|
||||
OBJS-$(CONFIG_DSICINVIDEO_DECODER) += dsicinvideo.o
|
||||
OBJS-$(CONFIG_DSS_SP_DECODER) += dss_sp.o
|
||||
OBJS-$(CONFIG_DST_DECODER) += dstdec.o dsd.o
|
||||
OBJS-$(CONFIG_DVBSUB_DECODER) += dvbsubdec.o
|
||||
OBJS-$(CONFIG_DVBSUB_ENCODER) += dvbsub.o
|
||||
OBJS-$(CONFIG_DVDSUB_DECODER) += dvdsubdec.o
|
||||
@@ -270,7 +258,7 @@ 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
|
||||
OBJS-$(CONFIG_EIGHTBPS_DECODER) += 8bps.o
|
||||
OBJS-$(CONFIG_EIGHTSVX_EXP_DECODER) += 8svx.o
|
||||
OBJS-$(CONFIG_EIGHTSVX_FIB_DECODER) += 8svx.o
|
||||
@@ -297,7 +285,7 @@ OBJS-$(CONFIG_G723_1_DECODER) += g723_1dec.o g723_1.o \
|
||||
acelp_vectors.o celp_filters.o celp_math.o
|
||||
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_G729_DECODER) += g729dec.o lsp.o celp_math.o acelp_filters.o acelp_pitch_delay.o acelp_vectors.o g729postfilter.o
|
||||
OBJS-$(CONFIG_GIF_DECODER) += gifdec.o lzw.o
|
||||
OBJS-$(CONFIG_GIF_ENCODER) += gif.o lzwenc.o
|
||||
OBJS-$(CONFIG_GSM_DECODER) += gsmdec.o gsmdec_data.o msgsmdec.o
|
||||
@@ -308,37 +296,22 @@ OBJS-$(CONFIG_H263_DECODER) += h263dec.o h263.o ituh263dec.o \
|
||||
mpeg4video.o mpeg4videodec.o flvdec.o\
|
||||
intelh263dec.o h263data.o
|
||||
OBJS-$(CONFIG_H263_ENCODER) += mpeg4videoenc.o mpeg4video.o \
|
||||
h263.o ituh263enc.o flvenc.o h263data.o
|
||||
OBJS-$(CONFIG_H264_DECODER) += h264dec.o h264_cabac.o h264_cavlc.o \
|
||||
h263.o h263data.o ituh263enc.o flvenc.o
|
||||
OBJS-$(CONFIG_H264_DECODER) += h264.o h264_cabac.o h264_cavlc.o \
|
||||
h264_direct.o h264_loopfilter.o \
|
||||
h264_mb.o h264_picture.o h264_ps.o \
|
||||
h264_refs.o h264_sei.o \
|
||||
h264_slice.o h264data.o h264_parse.o \
|
||||
h2645_parse.o
|
||||
OBJS-$(CONFIG_H264_CUVID_DECODER) += cuvid.o
|
||||
OBJS-$(CONFIG_H264_MEDIACODEC_DECODER) += mediacodecdec.o
|
||||
h264_refs.o h264_sei.o h264_slice.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_VDA_DECODER) += vda_h264_dec.o
|
||||
OBJS-$(CONFIG_H264_OMX_ENCODER) += omx.o
|
||||
OBJS-$(CONFIG_H264_QSV_DECODER) += qsvdec_h2645.o
|
||||
OBJS-$(CONFIG_H264_QSV_ENCODER) += qsvenc_h264.o
|
||||
OBJS-$(CONFIG_H264_VAAPI_ENCODER) += vaapi_encode_h264.o vaapi_encode_h26x.o
|
||||
OBJS-$(CONFIG_H264_VIDEOTOOLBOX_ENCODER) += videotoolboxenc.o
|
||||
OBJS-$(CONFIG_HAP_DECODER) += hapdec.o hap.o
|
||||
OBJS-$(CONFIG_HAP_ENCODER) += hapenc.o hap.o
|
||||
OBJS-$(CONFIG_HEVC_DECODER) += hevc.o hevc_mvs.o hevc_ps.o hevc_sei.o \
|
||||
hevc_cabac.o hevc_refs.o hevcpred.o \
|
||||
hevcdsp.o hevc_filter.o h2645_parse.o hevc_data.o
|
||||
OBJS-$(CONFIG_HEVC_CUVID_DECODER) += cuvid.o
|
||||
OBJS-$(CONFIG_HEVC_MEDIACODEC_DECODER) += mediacodecdec.o hevc_parse.o
|
||||
OBJS-$(CONFIG_HEVC_NVENC_ENCODER) += nvenc_hevc.o
|
||||
OBJS-$(CONFIG_NVENC_HEVC_ENCODER) += nvenc_hevc.o
|
||||
hevcdsp.o hevc_filter.o hevc_parse.o hevc_data.o
|
||||
OBJS-$(CONFIG_HEVC_QSV_DECODER) += qsvdec_h2645.o
|
||||
OBJS-$(CONFIG_HEVC_QSV_ENCODER) += qsvenc_hevc.o hevc_ps_enc.o h2645_parse.o
|
||||
OBJS-$(CONFIG_HEVC_VAAPI_ENCODER) += vaapi_encode_h265.o vaapi_encode_h26x.o
|
||||
OBJS-$(CONFIG_HEVC_QSV_ENCODER) += qsvenc_hevc.o hevc_ps_enc.o hevc_parse.o
|
||||
OBJS-$(CONFIG_HNM4_VIDEO_DECODER) += hnm4video.o
|
||||
OBJS-$(CONFIG_HQ_HQA_DECODER) += hq_hqa.o hq_hqadata.o hq_hqadsp.o \
|
||||
canopus.o
|
||||
@@ -369,10 +342,8 @@ OBJS-$(CONFIG_KMVC_DECODER) += kmvc.o
|
||||
OBJS-$(CONFIG_LAGARITH_DECODER) += lagarith.o lagarithrac.o
|
||||
OBJS-$(CONFIG_LJPEG_ENCODER) += ljpegenc.o mjpegenc_common.o
|
||||
OBJS-$(CONFIG_LOCO_DECODER) += loco.o
|
||||
OBJS-$(CONFIG_M101_DECODER) += m101.o
|
||||
OBJS-$(CONFIG_MACE3_DECODER) += mace.o
|
||||
OBJS-$(CONFIG_MACE6_DECODER) += mace.o
|
||||
OBJS-$(CONFIG_MAGICYUV_DECODER) += magicyuv.o
|
||||
OBJS-$(CONFIG_MDEC_DECODER) += mdec.o mpeg12.o mpeg12data.o
|
||||
OBJS-$(CONFIG_METASOUND_DECODER) += metasound.o metasound_data.o \
|
||||
twinvq.o
|
||||
@@ -381,9 +352,7 @@ OBJS-$(CONFIG_MIMIC_DECODER) += mimic.o
|
||||
OBJS-$(CONFIG_MJPEG_DECODER) += mjpegdec.o
|
||||
OBJS-$(CONFIG_MJPEG_ENCODER) += mjpegenc.o mjpegenc_common.o
|
||||
OBJS-$(CONFIG_MJPEGB_DECODER) += mjpegbdec.o
|
||||
OBJS-$(CONFIG_MJPEG_VAAPI_ENCODER) += vaapi_encode_mjpeg.o
|
||||
OBJS-$(CONFIG_MLP_DECODER) += mlpdec.o mlpdsp.o
|
||||
OBJS-$(CONFIG_MLP_ENCODER) += mlpenc.o mlp.o
|
||||
OBJS-$(CONFIG_MMVIDEO_DECODER) += mmvideo.o
|
||||
OBJS-$(CONFIG_MOTIONPIXELS_DECODER) += motionpixels.o
|
||||
OBJS-$(CONFIG_MOVTEXT_DECODER) += movtextdec.o ass.o
|
||||
@@ -407,24 +376,22 @@ OBJS-$(CONFIG_MPC8_DECODER) += mpc8.o mpc.o
|
||||
OBJS-$(CONFIG_MPEGVIDEO_DECODER) += mpeg12dec.o mpeg12.o mpeg12data.o
|
||||
OBJS-$(CONFIG_MPEG1VIDEO_DECODER) += mpeg12dec.o mpeg12.o mpeg12data.o
|
||||
OBJS-$(CONFIG_MPEG1VIDEO_ENCODER) += mpeg12enc.o mpeg12.o
|
||||
OBJS-$(CONFIG_MPEG2VIDEO_DECODER) += mpeg12dec.o mpeg12.o mpeg12data.o
|
||||
OBJS-$(CONFIG_MPEG2VIDEO_ENCODER) += mpeg12enc.o mpeg12.o
|
||||
OBJS-$(CONFIG_MPEG2_MMAL_DECODER) += mmaldec.o
|
||||
OBJS-$(CONFIG_MPEG2_QSV_DECODER) += qsvdec_mpeg2.o
|
||||
OBJS-$(CONFIG_MPEG2_QSV_ENCODER) += qsvenc_mpeg2.o
|
||||
OBJS-$(CONFIG_MPEG2VIDEO_DECODER) += mpeg12dec.o mpeg12.o mpeg12data.o
|
||||
OBJS-$(CONFIG_MPEG2VIDEO_ENCODER) += mpeg12enc.o mpeg12.o
|
||||
OBJS-$(CONFIG_MPEG4_DECODER) += xvididct.o
|
||||
OBJS-$(CONFIG_MPEG4_MEDIACODEC_DECODER) += mediacodecdec.o
|
||||
OBJS-$(CONFIG_MPEG4_OMX_ENCODER) += omx.o
|
||||
OBJS-$(CONFIG_MPL2_DECODER) += mpl2dec.o ass.o
|
||||
OBJS-$(CONFIG_MSA1_DECODER) += mss3.o
|
||||
OBJS-$(CONFIG_MSMPEG4V1_DECODER) += msmpeg4dec.o msmpeg4.o msmpeg4data.o
|
||||
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_MSRLE_DECODER) += msrle.o msrledec.o
|
||||
OBJS-$(CONFIG_MSA1_DECODER) += mss3.o
|
||||
OBJS-$(CONFIG_MSS1_DECODER) += mss1.o mss12.o
|
||||
OBJS-$(CONFIG_MSS2_DECODER) += mss2.o mss12.o mss2dsp.o wmv2data.o
|
||||
OBJS-$(CONFIG_MSS2_DECODER) += mss2.o mss12.o mss2dsp.o
|
||||
OBJS-$(CONFIG_MSVIDEO1_DECODER) += msvideo1.o
|
||||
OBJS-$(CONFIG_MSVIDEO1_ENCODER) += msvideo1enc.o elbg.o
|
||||
OBJS-$(CONFIG_MSZH_DECODER) += lcldec.o
|
||||
@@ -504,7 +471,6 @@ OBJS-$(CONFIG_SDX2_DPCM_DECODER) += dpcm.o
|
||||
OBJS-$(CONFIG_SGI_DECODER) += sgidec.o
|
||||
OBJS-$(CONFIG_SGI_ENCODER) += sgienc.o rle.o
|
||||
OBJS-$(CONFIG_SGIRLE_DECODER) += sgirledec.o
|
||||
OBJS-$(CONFIG_SHEERVIDEO_DECODER) += sheervideo.o
|
||||
OBJS-$(CONFIG_SHORTEN_DECODER) += shorten.o
|
||||
OBJS-$(CONFIG_SIPR_DECODER) += sipr.o acelp_pitch_delay.o \
|
||||
celp_math.o acelp_vectors.o \
|
||||
@@ -531,11 +497,10 @@ OBJS-$(CONFIG_SUBVIEWER1_DECODER) += textdec.o ass.o
|
||||
OBJS-$(CONFIG_SUBVIEWER_DECODER) += subviewerdec.o ass.o
|
||||
OBJS-$(CONFIG_SUNRAST_DECODER) += sunrast.o
|
||||
OBJS-$(CONFIG_SUNRAST_ENCODER) += sunrastenc.o
|
||||
OBJS-$(CONFIG_SVQ1_DECODER) += svq1dec.o svq1.o svq13.o h263data.o
|
||||
OBJS-$(CONFIG_SVQ1_ENCODER) += svq1enc.o svq1.o h263data.o \
|
||||
OBJS-$(CONFIG_SVQ1_DECODER) += svq1dec.o svq1.o svq13.o h263.o
|
||||
OBJS-$(CONFIG_SVQ1_ENCODER) += svq1enc.o svq1.o \
|
||||
h263.o ituh263enc.o
|
||||
OBJS-$(CONFIG_SVQ3_DECODER) += svq3.o svq13.o mpegutils.o \
|
||||
h264_parse.o h264data.o h264_ps.o h2645_parse.o
|
||||
OBJS-$(CONFIG_SVQ3_DECODER) += svq3.o svq13.o mpegutils.o
|
||||
OBJS-$(CONFIG_TEXT_DECODER) += textdec.o ass.o
|
||||
OBJS-$(CONFIG_TEXT_ENCODER) += srtenc.o ass_split.o
|
||||
OBJS-$(CONFIG_TAK_DECODER) += takdec.o tak.o takdsp.o
|
||||
@@ -548,15 +513,13 @@ OBJS-$(CONFIG_TIFF_DECODER) += tiff.o lzw.o faxcompr.o tiff_data.o ti
|
||||
OBJS-$(CONFIG_TIFF_ENCODER) += tiffenc.o rle.o lzwenc.o tiff_data.o
|
||||
OBJS-$(CONFIG_TMV_DECODER) += tmv.o cga_data.o
|
||||
OBJS-$(CONFIG_TRUEHD_DECODER) += mlpdec.o mlpdsp.o
|
||||
OBJS-$(CONFIG_TRUEHD_ENCODER) += mlpenc.o
|
||||
OBJS-$(CONFIG_TRUEMOTION1_DECODER) += truemotion1.o
|
||||
OBJS-$(CONFIG_TRUEMOTION2_DECODER) += truemotion2.o
|
||||
OBJS-$(CONFIG_TRUEMOTION2RT_DECODER) += truemotion2rt.o
|
||||
OBJS-$(CONFIG_TRUESPEECH_DECODER) += truespeech.o
|
||||
OBJS-$(CONFIG_TSCC_DECODER) += tscc.o msrledec.o
|
||||
OBJS-$(CONFIG_TSCC2_DECODER) += tscc2.o
|
||||
OBJS-$(CONFIG_TTA_DECODER) += tta.o ttadata.o ttadsp.o
|
||||
OBJS-$(CONFIG_TTA_ENCODER) += ttaenc.o ttaencdsp.o ttadata.o
|
||||
OBJS-$(CONFIG_TTA_ENCODER) += ttaenc.o ttadata.o
|
||||
OBJS-$(CONFIG_TWINVQ_DECODER) += twinvqdec.o twinvq.o
|
||||
OBJS-$(CONFIG_TXD_DECODER) += txd.o
|
||||
OBJS-$(CONFIG_ULTI_DECODER) += ulti.o
|
||||
@@ -564,20 +527,20 @@ OBJS-$(CONFIG_UTVIDEO_DECODER) += utvideodec.o utvideo.o
|
||||
OBJS-$(CONFIG_UTVIDEO_ENCODER) += utvideoenc.o utvideo.o
|
||||
OBJS-$(CONFIG_V210_DECODER) += v210dec.o
|
||||
OBJS-$(CONFIG_V210_ENCODER) += v210enc.o
|
||||
OBJS-$(CONFIG_V210X_DECODER) += v210x.o
|
||||
OBJS-$(CONFIG_V308_DECODER) += v308dec.o
|
||||
OBJS-$(CONFIG_V308_ENCODER) += v308enc.o
|
||||
OBJS-$(CONFIG_V408_DECODER) += v408dec.o
|
||||
OBJS-$(CONFIG_V408_ENCODER) += v408enc.o
|
||||
OBJS-$(CONFIG_V410_DECODER) += v410dec.o
|
||||
OBJS-$(CONFIG_V410_ENCODER) += v410enc.o
|
||||
OBJS-$(CONFIG_V210X_DECODER) += v210x.o
|
||||
OBJS-$(CONFIG_VB_DECODER) += vb.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 \
|
||||
vc1dsp.o \
|
||||
msmpeg4dec.o msmpeg4.o msmpeg4data.o \
|
||||
wmv2dsp.o wmv2data.o
|
||||
OBJS-$(CONFIG_VC1_CUVID_DECODER) += cuvid.o
|
||||
wmv2dsp.o
|
||||
OBJS-$(CONFIG_VC1_MMAL_DECODER) += mmaldec.o
|
||||
OBJS-$(CONFIG_VC1_QSV_DECODER) += qsvdec_vc1.o
|
||||
OBJS-$(CONFIG_VC2_ENCODER) += vc2enc.o vc2enc_dwt.o diractab.o
|
||||
@@ -595,12 +558,8 @@ OBJS-$(CONFIG_VP6_DECODER) += vp6.o vp56.o vp56data.o \
|
||||
vp6dsp.o vp56rac.o
|
||||
OBJS-$(CONFIG_VP7_DECODER) += vp8.o vp56rac.o
|
||||
OBJS-$(CONFIG_VP8_DECODER) += vp8.o vp56rac.o
|
||||
OBJS-$(CONFIG_VP8_CUVID_DECODER) += cuvid.o
|
||||
OBJS-$(CONFIG_VP8_MEDIACODEC_DECODER) += mediacodecdec.o
|
||||
OBJS-$(CONFIG_VP9_DECODER) += vp9.o vp9dsp.o vp56rac.o vp9dsp_8bpp.o \
|
||||
vp9dsp_10bpp.o vp9dsp_12bpp.o
|
||||
OBJS-$(CONFIG_VP9_CUVID_DECODER) += cuvid.o
|
||||
OBJS-$(CONFIG_VP9_MEDIACODEC_DECODER) += mediacodecdec.o
|
||||
OBJS-$(CONFIG_VPLAYER_DECODER) += textdec.o ass.o
|
||||
OBJS-$(CONFIG_VQA_DECODER) += vqavideo.o
|
||||
OBJS-$(CONFIG_WAVPACK_DECODER) += wavpack.o
|
||||
@@ -619,13 +578,13 @@ OBJS-$(CONFIG_WMAVOICE_DECODER) += wmavoice.o \
|
||||
acelp_vectors.o acelp_filters.o
|
||||
OBJS-$(CONFIG_WMV1_DECODER) += msmpeg4dec.o msmpeg4.o msmpeg4data.o
|
||||
OBJS-$(CONFIG_WMV1_ENCODER) += msmpeg4enc.o
|
||||
OBJS-$(CONFIG_WMV2_DECODER) += wmv2dec.o wmv2.o wmv2data.o \
|
||||
OBJS-$(CONFIG_WMV2_DECODER) += wmv2dec.o wmv2.o \
|
||||
msmpeg4dec.o msmpeg4.o msmpeg4data.o
|
||||
OBJS-$(CONFIG_WMV2_ENCODER) += wmv2enc.o wmv2.o wmv2data.o \
|
||||
OBJS-$(CONFIG_WMV2_ENCODER) += wmv2enc.o wmv2.o \
|
||||
msmpeg4.o msmpeg4enc.o msmpeg4data.o
|
||||
OBJS-$(CONFIG_WNV1_DECODER) += wnv1.o
|
||||
OBJS-$(CONFIG_WRAPPED_AVFRAME_ENCODER) += wrapped_avframe.o
|
||||
OBJS-$(CONFIG_WS_SND1_DECODER) += ws-snd1.o
|
||||
OBJS-$(CONFIG_WRAPPED_AVFRAME_ENCODER) += wrapped_avframe.o
|
||||
OBJS-$(CONFIG_XAN_DPCM_DECODER) += dpcm.o
|
||||
OBJS-$(CONFIG_XAN_WC3_DECODER) += xan.o
|
||||
OBJS-$(CONFIG_XAN_WC4_DECODER) += xxan.o
|
||||
@@ -643,7 +602,6 @@ OBJS-$(CONFIG_XWD_DECODER) += xwddec.o
|
||||
OBJS-$(CONFIG_XWD_ENCODER) += xwdenc.o
|
||||
OBJS-$(CONFIG_Y41P_DECODER) += y41pdec.o
|
||||
OBJS-$(CONFIG_Y41P_ENCODER) += y41penc.o
|
||||
OBJS-$(CONFIG_YLC_DECODER) += ylc.o
|
||||
OBJS-$(CONFIG_YOP_DECODER) += yop.o
|
||||
OBJS-$(CONFIG_YUV4_DECODER) += yuv4dec.o
|
||||
OBJS-$(CONFIG_YUV4_ENCODER) += yuv4enc.o
|
||||
@@ -695,10 +653,6 @@ OBJS-$(CONFIG_PCM_S32LE_DECODER) += pcm.o
|
||||
OBJS-$(CONFIG_PCM_S32LE_ENCODER) += pcm.o
|
||||
OBJS-$(CONFIG_PCM_S32LE_PLANAR_DECODER) += pcm.o
|
||||
OBJS-$(CONFIG_PCM_S32LE_PLANAR_ENCODER) += pcm.o
|
||||
OBJS-$(CONFIG_PCM_S64BE_DECODER) += pcm.o
|
||||
OBJS-$(CONFIG_PCM_S64BE_ENCODER) += pcm.o
|
||||
OBJS-$(CONFIG_PCM_S64LE_DECODER) += pcm.o
|
||||
OBJS-$(CONFIG_PCM_S64LE_ENCODER) += pcm.o
|
||||
OBJS-$(CONFIG_PCM_U8_DECODER) += pcm.o
|
||||
OBJS-$(CONFIG_PCM_U8_ENCODER) += pcm.o
|
||||
OBJS-$(CONFIG_PCM_U16BE_DECODER) += pcm.o
|
||||
@@ -735,7 +689,6 @@ OBJS-$(CONFIG_ADPCM_G726_ENCODER) += g726.o
|
||||
OBJS-$(CONFIG_ADPCM_G726LE_DECODER) += g726.o
|
||||
OBJS-$(CONFIG_ADPCM_IMA_AMV_DECODER) += adpcm.o adpcm_data.o
|
||||
OBJS-$(CONFIG_ADPCM_IMA_APC_DECODER) += adpcm.o adpcm_data.o
|
||||
OBJS-$(CONFIG_ADPCM_IMA_DAT4_DECODER) += adpcm.o adpcm_data.o
|
||||
OBJS-$(CONFIG_ADPCM_IMA_DK3_DECODER) += adpcm.o adpcm_data.o
|
||||
OBJS-$(CONFIG_ADPCM_IMA_DK4_DECODER) += adpcm.o adpcm_data.o
|
||||
OBJS-$(CONFIG_ADPCM_IMA_EA_EACS_DECODER) += adpcm.o adpcm_data.o
|
||||
@@ -751,7 +704,6 @@ 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_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
|
||||
OBJS-$(CONFIG_ADPCM_PSX_DECODER) += adpcm.o adpcm_data.o
|
||||
OBJS-$(CONFIG_ADPCM_SBPRO_2_DECODER) += adpcm.o adpcm_data.o
|
||||
OBJS-$(CONFIG_ADPCM_SBPRO_3_DECODER) += adpcm.o adpcm_data.o
|
||||
@@ -759,7 +711,6 @@ OBJS-$(CONFIG_ADPCM_SBPRO_4_DECODER) += adpcm.o adpcm_data.o
|
||||
OBJS-$(CONFIG_ADPCM_SWF_DECODER) += adpcm.o adpcm_data.o
|
||||
OBJS-$(CONFIG_ADPCM_SWF_ENCODER) += adpcmenc.o adpcm_data.o
|
||||
OBJS-$(CONFIG_ADPCM_THP_DECODER) += adpcm.o adpcm_data.o
|
||||
OBJS-$(CONFIG_ADPCM_THP_LE_DECODER) += adpcm.o adpcm_data.o
|
||||
OBJS-$(CONFIG_ADPCM_VIMA_DECODER) += vima.o adpcm_data.o
|
||||
OBJS-$(CONFIG_ADPCM_XA_DECODER) += adpcm.o adpcm_data.o
|
||||
OBJS-$(CONFIG_ADPCM_YAMAHA_DECODER) += adpcm.o adpcm_data.o
|
||||
@@ -806,24 +757,28 @@ OBJS-$(CONFIG_VP9_DXVA2_HWACCEL) += dxva2_vp9.o
|
||||
OBJS-$(CONFIG_VP9_VAAPI_HWACCEL) += vaapi_vp9.o
|
||||
|
||||
# libavformat dependencies
|
||||
OBJS-$(CONFIG_ISO_MEDIA) += mpeg4audio.o mpegaudiodata.o
|
||||
|
||||
OBJS-$(CONFIG_ADTS_MUXER) += mpeg4audio.o
|
||||
OBJS-$(CONFIG_CAF_DEMUXER) += ac3tab.o
|
||||
OBJS-$(CONFIG_DNXHD_DEMUXER) += dnxhddata.o
|
||||
OBJS-$(CONFIG_AVI_DEMUXER) += mpeg4audio.o mpegaudiodata.o
|
||||
OBJS-$(CONFIG_CAF_DEMUXER) += mpeg4audio.o mpegaudiodata.o \
|
||||
ac3tab.o
|
||||
OBJS-$(CONFIG_FLAC_DEMUXER) += flac.o flacdata.o vorbis_data.o
|
||||
OBJS-$(CONFIG_FLAC_MUXER) += flac.o flacdata.o vorbis_data.o
|
||||
OBJS-$(CONFIG_FLV_DEMUXER) += mpeg4audio.o
|
||||
OBJS-$(CONFIG_GXF_DEMUXER) += mpeg12data.o
|
||||
OBJS-$(CONFIG_IFF_DEMUXER) += iff.o
|
||||
OBJS-$(CONFIG_ISMV_MUXER) += mpeg4audio.o mpegaudiodata.o
|
||||
OBJS-$(CONFIG_LATM_MUXER) += mpeg4audio.o
|
||||
OBJS-$(CONFIG_MATROSKA_AUDIO_MUXER) += mpeg4audio.o vorbis_data.o \
|
||||
flac.o flacdata.o
|
||||
OBJS-$(CONFIG_MATROSKA_MUXER) += flac.o flacdata.o vorbis_data.o
|
||||
OBJS-$(CONFIG_MOV_DEMUXER) += ac3tab.o
|
||||
OBJS-$(CONFIG_MATROSKA_DEMUXER) += mpeg4audio.o mpegaudiodata.o
|
||||
OBJS-$(CONFIG_MATROSKA_MUXER) += mpeg4audio.o mpegaudiodata.o \
|
||||
flac.o flacdata.o vorbis_data.o
|
||||
OBJS-$(CONFIG_MP2_MUXER) += mpegaudiodata.o mpegaudiodecheader.o
|
||||
OBJS-$(CONFIG_MP3_MUXER) += mpegaudiodata.o mpegaudiodecheader.o
|
||||
OBJS-$(CONFIG_MOV_DEMUXER) += mpeg4audio.o mpegaudiodata.o ac3tab.o
|
||||
OBJS-$(CONFIG_MOV_MUXER) += mpeg4audio.o mpegaudiodata.o
|
||||
OBJS-$(CONFIG_MPEGTS_MUXER) += mpeg4audio.o
|
||||
OBJS-$(CONFIG_MPEGTS_DEMUXER) += mpeg4audio.o mpegaudiodata.o
|
||||
OBJS-$(CONFIG_MXF_MUXER) += dnxhddata.o
|
||||
OBJS-$(CONFIG_NUT_MUXER) += mpegaudiodata.o
|
||||
OBJS-$(CONFIG_NUT_DEMUXER) += mpegaudiodata.o mpeg4audio.o
|
||||
@@ -839,32 +794,15 @@ OBJS-$(CONFIG_TAK_DEMUXER) += tak.o
|
||||
OBJS-$(CONFIG_WEBM_MUXER) += mpeg4audio.o mpegaudiodata.o \
|
||||
flac.o flacdata.o \
|
||||
vorbis_data.o
|
||||
OBJS-$(CONFIG_WTV_DEMUXER) += mpeg4audio.o mpegaudiodata.o
|
||||
|
||||
# libavfilter dependencies
|
||||
OBJS-$(CONFIG_ELBG_FILTER) += elbg.o
|
||||
|
||||
# external codec libraries
|
||||
OBJS-$(CONFIG_AAC_AT_DECODER) += audiotoolboxdec.o
|
||||
OBJS-$(CONFIG_AC3_AT_DECODER) += audiotoolboxdec.o
|
||||
OBJS-$(CONFIG_ADPCM_IMA_QT_AT_DECODER) += audiotoolboxdec.o
|
||||
OBJS-$(CONFIG_ALAC_AT_DECODER) += audiotoolboxdec.o
|
||||
OBJS-$(CONFIG_AMR_NB_AT_DECODER) += audiotoolboxdec.o
|
||||
OBJS-$(CONFIG_EAC3_AT_DECODER) += audiotoolboxdec.o
|
||||
OBJS-$(CONFIG_GSM_MS_AT_DECODER) += audiotoolboxdec.o
|
||||
OBJS-$(CONFIG_ILBC_AT_DECODER) += audiotoolboxdec.o
|
||||
OBJS-$(CONFIG_MP1_AT_DECODER) += audiotoolboxdec.o mpegaudiodata.o mpegaudiodecheader.o
|
||||
OBJS-$(CONFIG_MP2_AT_DECODER) += audiotoolboxdec.o mpegaudiodata.o mpegaudiodecheader.o
|
||||
OBJS-$(CONFIG_MP3_AT_DECODER) += audiotoolboxdec.o mpegaudiodata.o mpegaudiodecheader.o
|
||||
OBJS-$(CONFIG_PCM_MULAW_AT_DECODER) += audiotoolboxdec.o
|
||||
OBJS-$(CONFIG_PCM_ALAW_AT_DECODER) += audiotoolboxdec.o
|
||||
OBJS-$(CONFIG_QDMC_AT_DECODER) += audiotoolboxdec.o
|
||||
OBJS-$(CONFIG_QDM2_AT_DECODER) += audiotoolboxdec.o
|
||||
OBJS-$(CONFIG_AAC_AT_ENCODER) += audiotoolboxenc.o
|
||||
OBJS-$(CONFIG_ALAC_AT_ENCODER) += audiotoolboxenc.o
|
||||
OBJS-$(CONFIG_ILBC_AT_ENCODER) += audiotoolboxenc.o
|
||||
OBJS-$(CONFIG_PCM_ALAW_AT_ENCODER) += audiotoolboxenc.o
|
||||
OBJS-$(CONFIG_PCM_MULAW_AT_ENCODER) += audiotoolboxenc.o
|
||||
OBJS-$(CONFIG_LIBCELT_DECODER) += libcelt_dec.o
|
||||
OBJS-$(CONFIG_LIBDCADEC_DECODER) += libdcadec.o dca.o
|
||||
OBJS-$(CONFIG_LIBFAAC_ENCODER) += libfaac.o
|
||||
OBJS-$(CONFIG_LIBFDK_AAC_DECODER) += libfdk-aacdec.o
|
||||
OBJS-$(CONFIG_LIBFDK_AAC_ENCODER) += libfdk-aacenc.o
|
||||
OBJS-$(CONFIG_LIBGSM_DECODER) += libgsmdec.o
|
||||
@@ -874,12 +812,11 @@ OBJS-$(CONFIG_LIBGSM_MS_ENCODER) += libgsmenc.o
|
||||
OBJS-$(CONFIG_LIBILBC_DECODER) += libilbc.o
|
||||
OBJS-$(CONFIG_LIBILBC_ENCODER) += libilbc.o
|
||||
OBJS-$(CONFIG_LIBKVAZAAR_ENCODER) += libkvazaar.o
|
||||
OBJS-$(CONFIG_LIBMP3LAME_ENCODER) += libmp3lame.o mpegaudiodata.o mpegaudiodecheader.o
|
||||
OBJS-$(CONFIG_LIBMP3LAME_ENCODER) += libmp3lame.o mpegaudiodecheader.o
|
||||
OBJS-$(CONFIG_LIBOPENCORE_AMRNB_DECODER) += libopencore-amr.o
|
||||
OBJS-$(CONFIG_LIBOPENCORE_AMRNB_ENCODER) += libopencore-amr.o
|
||||
OBJS-$(CONFIG_LIBOPENCORE_AMRWB_DECODER) += libopencore-amr.o
|
||||
OBJS-$(CONFIG_LIBOPENH264_DECODER) += libopenh264dec.o libopenh264.o
|
||||
OBJS-$(CONFIG_LIBOPENH264_ENCODER) += libopenh264enc.o libopenh264.o
|
||||
OBJS-$(CONFIG_LIBOPENH264_ENCODER) += libopenh264enc.o
|
||||
OBJS-$(CONFIG_LIBOPENJPEG_DECODER) += libopenjpegdec.o
|
||||
OBJS-$(CONFIG_LIBOPENJPEG_ENCODER) += libopenjpegenc.o
|
||||
OBJS-$(CONFIG_LIBOPUS_DECODER) += libopusdec.o libopus.o \
|
||||
@@ -895,6 +832,8 @@ OBJS-$(CONFIG_LIBSPEEX_DECODER) += libspeexdec.o
|
||||
OBJS-$(CONFIG_LIBSPEEX_ENCODER) += libspeexenc.o
|
||||
OBJS-$(CONFIG_LIBTHEORA_ENCODER) += libtheoraenc.o
|
||||
OBJS-$(CONFIG_LIBTWOLAME_ENCODER) += libtwolame.o
|
||||
OBJS-$(CONFIG_LIBUTVIDEO_DECODER) += libutvideodec.o
|
||||
OBJS-$(CONFIG_LIBUTVIDEO_ENCODER) += libutvideoenc.o
|
||||
OBJS-$(CONFIG_LIBVO_AMRWBENC_ENCODER) += libvo-amrwbenc.o
|
||||
OBJS-$(CONFIG_LIBVORBIS_DECODER) += libvorbisdec.o
|
||||
OBJS-$(CONFIG_LIBVORBIS_ENCODER) += libvorbisenc.o \
|
||||
@@ -911,19 +850,19 @@ OBJS-$(CONFIG_LIBX264_ENCODER) += libx264.o
|
||||
OBJS-$(CONFIG_LIBX265_ENCODER) += libx265.o
|
||||
OBJS-$(CONFIG_LIBXAVS_ENCODER) += libxavs.o
|
||||
OBJS-$(CONFIG_LIBXVID_ENCODER) += libxvid.o
|
||||
OBJS-$(CONFIG_LIBZVBI_TELETEXT_DECODER) += libzvbi-teletextdec.o ass.o
|
||||
OBJS-$(CONFIG_LIBZVBI_TELETEXT_DECODER) += libzvbi-teletextdec.o
|
||||
|
||||
# parsers
|
||||
OBJS-$(CONFIG_AAC_LATM_PARSER) += latm_parser.o
|
||||
OBJS-$(CONFIG_AAC_PARSER) += aac_parser.o aac_ac3_parser.o \
|
||||
aacadtsdec.o mpeg4audio.o
|
||||
OBJS-$(CONFIG_AAC_LATM_PARSER) += latm_parser.o
|
||||
OBJS-$(CONFIG_AC3_PARSER) += ac3_parser.o ac3tab.o \
|
||||
aac_ac3_parser.o
|
||||
OBJS-$(CONFIG_ADX_PARSER) += adx_parser.o adx.o
|
||||
OBJS-$(CONFIG_BMP_PARSER) += bmp_parser.o
|
||||
OBJS-$(CONFIG_CAVSVIDEO_PARSER) += cavs_parser.o
|
||||
OBJS-$(CONFIG_COOK_PARSER) += cook_parser.o
|
||||
OBJS-$(CONFIG_DCA_PARSER) += dca_parser.o dca_exss.o dca.o
|
||||
OBJS-$(CONFIG_DCA_PARSER) += dca_parser.o dca.o
|
||||
OBJS-$(CONFIG_DIRAC_PARSER) += dirac_parser.o
|
||||
OBJS-$(CONFIG_DNXHD_PARSER) += dnxhd_parser.o
|
||||
OBJS-$(CONFIG_DPX_PARSER) += dpx_parser.o
|
||||
@@ -937,9 +876,8 @@ OBJS-$(CONFIG_G729_PARSER) += g729_parser.o
|
||||
OBJS-$(CONFIG_GSM_PARSER) += gsm_parser.o
|
||||
OBJS-$(CONFIG_H261_PARSER) += h261_parser.o
|
||||
OBJS-$(CONFIG_H263_PARSER) += h263_parser.o
|
||||
OBJS-$(CONFIG_H264_PARSER) += h264_parser.o h264_parse.o h2645_parse.o \
|
||||
h264_ps.o h264_sei.o h264data.o
|
||||
OBJS-$(CONFIG_HEVC_PARSER) += hevc_parser.o h2645_parse.o hevc_ps.o hevc_data.o
|
||||
OBJS-$(CONFIG_H264_PARSER) += h264_parser.o
|
||||
OBJS-$(CONFIG_HEVC_PARSER) += hevc_parser.o hevc_parse.o hevc_ps.o hevc_data.o
|
||||
OBJS-$(CONFIG_MJPEG_PARSER) += mjpeg_parser.o
|
||||
OBJS-$(CONFIG_MLP_PARSER) += mlp_parser.o mlp.o
|
||||
OBJS-$(CONFIG_MPEG4VIDEO_PARSER) += mpeg4video_parser.o h263.o \
|
||||
@@ -956,8 +894,7 @@ OBJS-$(CONFIG_PNM_PARSER) += pnm_parser.o pnm.o
|
||||
OBJS-$(CONFIG_RV30_PARSER) += rv34_parser.o
|
||||
OBJS-$(CONFIG_RV40_PARSER) += rv34_parser.o
|
||||
OBJS-$(CONFIG_TAK_PARSER) += tak_parser.o tak.o
|
||||
OBJS-$(CONFIG_VC1_PARSER) += vc1_parser.o vc1.o vc1data.o \
|
||||
simple_idct.o wmv2data.o
|
||||
OBJS-$(CONFIG_VC1_PARSER) += vc1_parser.o
|
||||
OBJS-$(CONFIG_VP3_PARSER) += vp3_parser.o
|
||||
OBJS-$(CONFIG_VP8_PARSER) += vp8_parser.o
|
||||
OBJS-$(CONFIG_VP9_PARSER) += vp9_parser.o
|
||||
@@ -967,7 +904,6 @@ OBJS-$(CONFIG_AAC_ADTSTOASC_BSF) += aac_adtstoasc_bsf.o aacadtsdec.o \
|
||||
mpeg4audio.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_H264_MP4TOANNEXB_BSF) += h264_mp4toannexb_bsf.o
|
||||
OBJS-$(CONFIG_HEVC_MP4TOANNEXB_BSF) += hevc_mp4toannexb_bsf.o
|
||||
OBJS-$(CONFIG_IMX_DUMP_HEADER_BSF) += imx_dump_header_bsf.o
|
||||
@@ -980,7 +916,6 @@ OBJS-$(CONFIG_MP3_HEADER_DECOMPRESS_BSF) += mp3_header_decompress_bsf.o \
|
||||
OBJS-$(CONFIG_NOISE_BSF) += noise_bsf.o
|
||||
OBJS-$(CONFIG_REMOVE_EXTRADATA_BSF) += remove_extradata_bsf.o
|
||||
OBJS-$(CONFIG_TEXT2MOVSUB_BSF) += movsub_bsf.o
|
||||
OBJS-$(CONFIG_VP9_SUPERFRAME_BSF) += vp9_superframe_bsf.o
|
||||
|
||||
# thread libraries
|
||||
OBJS-$(HAVE_LIBC_MSVCRT) += file_open.o
|
||||
@@ -1004,17 +939,15 @@ SKIPHEADERS += %_tablegen.h \
|
||||
|
||||
SKIPHEADERS-$(CONFIG_D3D11VA) += d3d11va.h dxva2_internal.h
|
||||
SKIPHEADERS-$(CONFIG_DXVA2) += dxva2.h dxva2_internal.h
|
||||
SKIPHEADERS-$(CONFIG_JNI) += ffjni.h
|
||||
SKIPHEADERS-$(CONFIG_LIBSCHROEDINGER) += libschroedinger.h
|
||||
SKIPHEADERS-$(CONFIG_LIBUTVIDEO) += libutvideo.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
|
||||
SKIPHEADERS-$(CONFIG_NVENC) += nvenc.h
|
||||
SKIPHEADERS-$(CONFIG_QSV) += qsv.h qsv_internal.h
|
||||
SKIPHEADERS-$(CONFIG_QSVDEC) += qsvdec.h
|
||||
SKIPHEADERS-$(CONFIG_QSVENC) += qsvenc.h
|
||||
SKIPHEADERS-$(CONFIG_XVMC) += xvmc.h
|
||||
SKIPHEADERS-$(CONFIG_VAAPI) += vaapi_encode.h vaapi_internal.h
|
||||
SKIPHEADERS-$(CONFIG_VAAPI) += vaapi_internal.h
|
||||
SKIPHEADERS-$(CONFIG_VDA) += vda.h vda_vt_internal.h
|
||||
SKIPHEADERS-$(CONFIG_VDPAU) += vdpau.h vdpau_internal.h
|
||||
SKIPHEADERS-$(CONFIG_VIDEOTOOLBOX) += videotoolbox.h vda_vt_internal.h
|
||||
@@ -1023,15 +956,14 @@ TESTPROGS = imgconvert \
|
||||
jpeg2000dwt \
|
||||
mathops \
|
||||
options \
|
||||
utils \
|
||||
avfft \
|
||||
|
||||
TESTPROGS-$(CONFIG_CABAC) += cabac
|
||||
TESTPROGS-$(CONFIG_DCT) += avfft
|
||||
TESTPROGS-$(CONFIG_FFT) += fft fft-fixed fft-fixed32
|
||||
TESTPROGS-$(CONFIG_GOLOMB) += golomb
|
||||
TESTPROGS-$(CONFIG_IDCTDSP) += dct
|
||||
TESTPROGS-$(CONFIG_IIRFILTER) += iirfilter
|
||||
TESTPROGS-$(HAVE_MMX) += motion
|
||||
TESTPROGS-$(CONFIG_GOLOMB) += golomb
|
||||
TESTPROGS-$(CONFIG_RANGECODER) += rangecoder
|
||||
TESTPROGS-$(CONFIG_SNOW_ENCODER) += snowenc
|
||||
|
||||
@@ -1054,7 +986,7 @@ HOSTPROGS = aacps_tablegen \
|
||||
|
||||
CLEANFILES = *_tables.c *_tables.h *_tablegen$(HOSTEXESUF)
|
||||
|
||||
$(SUBDIR)tests/dct$(EXESUF): $(SUBDIR)dctref.o $(SUBDIR)aandcttab.o
|
||||
$(SUBDIR)dct-test$(EXESUF): $(SUBDIR)dctref.o $(SUBDIR)aandcttab.o
|
||||
$(SUBDIR)dv_tablegen$(HOSTEXESUF): $(SUBDIR)dvdata_host.o
|
||||
|
||||
TRIG_TABLES = cos cos_fixed sin
|
||||
@@ -1079,17 +1011,17 @@ $(GEN_HEADERS): $(SUBDIR)%_tables.h: $(SUBDIR)%_tablegen$(HOSTEXESUF)
|
||||
$(M)./$< > $@
|
||||
|
||||
ifdef CONFIG_HARDCODED_TABLES
|
||||
$(SUBDIR)cbrt_data.o: $(SUBDIR)cbrt_tables.h
|
||||
$(SUBDIR)cbrt_data_fixed.o: $(SUBDIR)cbrt_fixed_tables.h
|
||||
$(SUBDIR)aacdec.o: $(SUBDIR)cbrt_tables.h
|
||||
$(SUBDIR)aacdec_fixed.o: $(SUBDIR)cbrt_fixed_tables.h
|
||||
$(SUBDIR)aacps_float.o: $(SUBDIR)aacps_tables.h
|
||||
$(SUBDIR)aacps_fixed.o: $(SUBDIR)aacps_fixed_tables.h
|
||||
$(SUBDIR)aactab_fixed.o: $(SUBDIR)aac_fixed_tables.h
|
||||
$(SUBDIR)dvenc.o: $(SUBDIR)dv_tables.h
|
||||
$(SUBDIR)motionpixels.o: $(SUBDIR)motionpixels_tables.h
|
||||
$(SUBDIR)mpegaudiodec_fixed.o: $(SUBDIR)mpegaudio_tables.h
|
||||
$(SUBDIR)mpegaudiodec_float.o: $(SUBDIR)mpegaudio_tables.h
|
||||
$(SUBDIR)pcm.o: $(SUBDIR)pcm_tables.h
|
||||
$(SUBDIR)qdm2.o: $(SUBDIR)qdm2_tables.h
|
||||
$(SUBDIR)sinewin.o: $(SUBDIR)sinewin_tables.h
|
||||
$(SUBDIR)sinewin_fixed.o: $(SUBDIR)sinewin_fixed_tables.h
|
||||
$(SUBDIR)mpegaudiodec_fixed.o: $(SUBDIR)mpegaudio_tables.h
|
||||
$(SUBDIR)mpegaudiodec_float.o: $(SUBDIR)mpegaudio_tables.h
|
||||
$(SUBDIR)motionpixels.o: $(SUBDIR)motionpixels_tables.h
|
||||
$(SUBDIR)pcm.o: $(SUBDIR)pcm_tables.h
|
||||
$(SUBDIR)qdm2.o: $(SUBDIR)qdm2_tables.h
|
||||
endif
|
||||
|
||||
@@ -34,7 +34,6 @@ int ff_aac_ac3_parse(AVCodecParserContext *s1,
|
||||
ParseContext *pc = &s->pc;
|
||||
int len, i;
|
||||
int new_frame_start;
|
||||
int got_frame = 0;
|
||||
|
||||
get_next:
|
||||
i=END_NOT_FOUND;
|
||||
@@ -52,7 +51,6 @@ get_next:
|
||||
if(len<=0){
|
||||
i=END_NOT_FOUND;
|
||||
}else{
|
||||
got_frame = 1;
|
||||
s->state=0;
|
||||
i-= s->header_size -1;
|
||||
s->remaining_size = len;
|
||||
@@ -78,34 +76,31 @@ get_next:
|
||||
if(s->codec_id)
|
||||
avctx->codec_id = s->codec_id;
|
||||
|
||||
if (got_frame) {
|
||||
/* Due to backwards compatible HE-AAC the sample rate, channel count,
|
||||
and total number of samples found in an AAC ADTS header are not
|
||||
reliable. Bit rate is still accurate because the total frame
|
||||
duration in seconds is still correct (as is the number of bits in
|
||||
the frame). */
|
||||
if (avctx->codec_id != AV_CODEC_ID_AAC) {
|
||||
avctx->sample_rate = s->sample_rate;
|
||||
/* Due to backwards compatible HE-AAC the sample rate, channel count,
|
||||
and total number of samples found in an AAC ADTS header are not
|
||||
reliable. Bit rate is still accurate because the total frame duration in
|
||||
seconds is still correct (as is the number of bits in the frame). */
|
||||
if (avctx->codec_id != AV_CODEC_ID_AAC) {
|
||||
avctx->sample_rate = s->sample_rate;
|
||||
|
||||
/* (E-)AC-3: allow downmixing to stereo or mono */
|
||||
if (s->channels > 1 &&
|
||||
avctx->request_channel_layout == AV_CH_LAYOUT_MONO) {
|
||||
avctx->channels = 1;
|
||||
avctx->channel_layout = AV_CH_LAYOUT_MONO;
|
||||
} else if (s->channels > 2 &&
|
||||
avctx->request_channel_layout == AV_CH_LAYOUT_STEREO) {
|
||||
avctx->channels = 2;
|
||||
avctx->channel_layout = AV_CH_LAYOUT_STEREO;
|
||||
} else {
|
||||
avctx->channels = s->channels;
|
||||
avctx->channel_layout = s->channel_layout;
|
||||
}
|
||||
s1->duration = s->samples;
|
||||
avctx->audio_service_type = s->service_type;
|
||||
/* (E-)AC-3: allow downmixing to stereo or mono */
|
||||
if (s->channels > 1 &&
|
||||
avctx->request_channel_layout == AV_CH_LAYOUT_MONO) {
|
||||
avctx->channels = 1;
|
||||
avctx->channel_layout = AV_CH_LAYOUT_MONO;
|
||||
} else if (s->channels > 2 &&
|
||||
avctx->request_channel_layout == AV_CH_LAYOUT_STEREO) {
|
||||
avctx->channels = 2;
|
||||
avctx->channel_layout = AV_CH_LAYOUT_STEREO;
|
||||
} else {
|
||||
avctx->channels = s->channels;
|
||||
avctx->channel_layout = s->channel_layout;
|
||||
}
|
||||
|
||||
avctx->bit_rate = s->bit_rate;
|
||||
s1->duration = s->samples;
|
||||
avctx->audio_service_type = s->service_type;
|
||||
}
|
||||
|
||||
avctx->bit_rate = s->bit_rate;
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
|
||||
#include "avcodec.h"
|
||||
#include "aacadtsdec.h"
|
||||
#include "bsf.h"
|
||||
#include "put_bits.h"
|
||||
#include "get_bits.h"
|
||||
#include "mpeg4audio.h"
|
||||
@@ -35,75 +34,68 @@ typedef struct AACBSFContext {
|
||||
* This filter creates an MPEG-4 AudioSpecificConfig from an MPEG-2/4
|
||||
* ADTS header and removes the ADTS header.
|
||||
*/
|
||||
static int aac_adtstoasc_filter(AVBSFContext *bsfc, AVPacket *out)
|
||||
static int aac_adtstoasc_filter(AVBitStreamFilterContext *bsfc,
|
||||
AVCodecContext *avctx, const char *args,
|
||||
uint8_t **poutbuf, int *poutbuf_size,
|
||||
const uint8_t *buf, int buf_size,
|
||||
int keyframe)
|
||||
{
|
||||
AACBSFContext *ctx = bsfc->priv_data;
|
||||
|
||||
GetBitContext gb;
|
||||
PutBitContext pb;
|
||||
AACADTSHeaderInfo hdr;
|
||||
AVPacket *in;
|
||||
int ret;
|
||||
|
||||
ret = ff_bsf_get_packet(bsfc, &in);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
AACBSFContext *ctx = bsfc->priv_data;
|
||||
|
||||
if (in->size < AAC_ADTS_HEADER_SIZE)
|
||||
goto packet_too_small;
|
||||
init_get_bits(&gb, buf, AAC_ADTS_HEADER_SIZE*8);
|
||||
|
||||
init_get_bits(&gb, in->data, AAC_ADTS_HEADER_SIZE * 8);
|
||||
*poutbuf = (uint8_t*) buf;
|
||||
*poutbuf_size = buf_size;
|
||||
|
||||
if (bsfc->par_in->extradata && show_bits(&gb, 12) != 0xfff)
|
||||
goto finish;
|
||||
if (avctx->extradata)
|
||||
if (show_bits(&gb, 12) != 0xfff)
|
||||
return 0;
|
||||
|
||||
if (avpriv_aac_parse_header(&gb, &hdr) < 0) {
|
||||
av_log(bsfc, AV_LOG_ERROR, "Error parsing ADTS frame header!\n");
|
||||
ret = AVERROR_INVALIDDATA;
|
||||
goto fail;
|
||||
av_log(avctx, AV_LOG_ERROR, "Error parsing ADTS frame header!\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
if (!hdr.crc_absent && hdr.num_aac_frames > 1) {
|
||||
avpriv_report_missing_feature(bsfc,
|
||||
avpriv_report_missing_feature(avctx,
|
||||
"Multiple RDBs per frame with CRC");
|
||||
ret = AVERROR_PATCHWELCOME;
|
||||
goto fail;
|
||||
return AVERROR_PATCHWELCOME;
|
||||
}
|
||||
|
||||
in->size -= AAC_ADTS_HEADER_SIZE + 2 * !hdr.crc_absent;
|
||||
if (in->size <= 0)
|
||||
goto packet_too_small;
|
||||
in->data += AAC_ADTS_HEADER_SIZE + 2 * !hdr.crc_absent;
|
||||
buf += AAC_ADTS_HEADER_SIZE + 2*!hdr.crc_absent;
|
||||
buf_size -= AAC_ADTS_HEADER_SIZE + 2*!hdr.crc_absent;
|
||||
|
||||
if (!ctx->first_frame_done) {
|
||||
int pce_size = 0;
|
||||
uint8_t pce_data[MAX_PCE_SIZE];
|
||||
uint8_t *extradata;
|
||||
|
||||
if (!hdr.chan_config) {
|
||||
init_get_bits(&gb, in->data, in->size * 8);
|
||||
init_get_bits(&gb, buf, buf_size * 8);
|
||||
if (get_bits(&gb, 3) != 5) {
|
||||
avpriv_report_missing_feature(bsfc,
|
||||
avpriv_report_missing_feature(avctx,
|
||||
"PCE-based channel configuration "
|
||||
"without PCE as first syntax "
|
||||
"element");
|
||||
ret = AVERROR_PATCHWELCOME;
|
||||
goto fail;
|
||||
return AVERROR_PATCHWELCOME;
|
||||
}
|
||||
init_put_bits(&pb, pce_data, MAX_PCE_SIZE);
|
||||
pce_size = avpriv_copy_pce_data(&pb, &gb)/8;
|
||||
flush_put_bits(&pb);
|
||||
in->size -= get_bits_count(&gb)/8;
|
||||
in->data += get_bits_count(&gb)/8;
|
||||
buf_size -= get_bits_count(&gb)/8;
|
||||
buf += get_bits_count(&gb)/8;
|
||||
}
|
||||
av_free(avctx->extradata);
|
||||
avctx->extradata_size = 2 + pce_size;
|
||||
avctx->extradata = av_mallocz(avctx->extradata_size + AV_INPUT_BUFFER_PADDING_SIZE);
|
||||
if (!avctx->extradata) {
|
||||
avctx->extradata_size = 0;
|
||||
return AVERROR(ENOMEM);
|
||||
}
|
||||
|
||||
extradata = av_mallocz(2 + pce_size + AV_INPUT_BUFFER_PADDING_SIZE);
|
||||
if (!extradata) {
|
||||
ret = AVERROR(ENOMEM);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
init_put_bits(&pb, extradata, 2 + pce_size);
|
||||
init_put_bits(&pb, avctx->extradata, avctx->extradata_size);
|
||||
put_bits(&pb, 5, hdr.object_type);
|
||||
put_bits(&pb, 4, hdr.sampling_index);
|
||||
put_bits(&pb, 4, hdr.chan_config);
|
||||
@@ -112,44 +104,20 @@ static int aac_adtstoasc_filter(AVBSFContext *bsfc, AVPacket *out)
|
||||
put_bits(&pb, 1, 0); //is not extension
|
||||
flush_put_bits(&pb);
|
||||
if (pce_size) {
|
||||
memcpy(extradata + 2, pce_data, pce_size);
|
||||
memcpy(avctx->extradata + 2, pce_data, pce_size);
|
||||
}
|
||||
|
||||
bsfc->par_out->extradata = extradata;
|
||||
bsfc->par_out->extradata_size = 2 + pce_size;
|
||||
ctx->first_frame_done = 1;
|
||||
}
|
||||
|
||||
finish:
|
||||
av_packet_move_ref(out, in);
|
||||
av_packet_free(&in);
|
||||
|
||||
return 0;
|
||||
|
||||
packet_too_small:
|
||||
av_log(bsfc, AV_LOG_ERROR, "Input packet too small\n");
|
||||
ret = AVERROR_INVALIDDATA;
|
||||
fail:
|
||||
av_packet_free(&in);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int aac_adtstoasc_init(AVBSFContext *ctx)
|
||||
{
|
||||
av_freep(&ctx->par_out->extradata);
|
||||
ctx->par_out->extradata_size = 0;
|
||||
*poutbuf = (uint8_t*) buf;
|
||||
*poutbuf_size = buf_size;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const enum AVCodecID codec_ids[] = {
|
||||
AV_CODEC_ID_AAC, AV_CODEC_ID_NONE,
|
||||
};
|
||||
|
||||
const AVBitStreamFilter ff_aac_adtstoasc_bsf = {
|
||||
AVBitStreamFilter ff_aac_adtstoasc_bsf = {
|
||||
.name = "aac_adtstoasc",
|
||||
.priv_data_size = sizeof(AACBSFContext),
|
||||
.init = aac_adtstoasc_init,
|
||||
.filter = aac_adtstoasc_filter,
|
||||
.codec_ids = codec_ids,
|
||||
};
|
||||
|
||||
@@ -89,9 +89,9 @@ typedef float AAC_FLOAT;
|
||||
typedef unsigned AAC_SIGNE;
|
||||
#define FIXR(x) ((float)(x))
|
||||
#define FIXR10(x) ((float)(x))
|
||||
#define Q23(x) ((float)(x))
|
||||
#define Q30(x) ((float)(x))
|
||||
#define Q31(x) ((float)(x))
|
||||
#define Q23(x) x
|
||||
#define Q30(x) x
|
||||
#define Q31(x) x
|
||||
#define RANGE15(x) (32768.0 * (x))
|
||||
#define GET_GAIN(x, y) powf((x), -(y))
|
||||
#define AAC_MUL16(x, y) ((x) * (y))
|
||||
|
||||
@@ -88,7 +88,7 @@ static void encode_window_bands_info(AACEncContext *s, SingleChannelElement *sce
|
||||
float next_minrd = INFINITY;
|
||||
int next_mincb = 0;
|
||||
|
||||
s->abs_pow34(s->scoefs, sce->coeffs, 1024);
|
||||
abs_pow34_v(s->scoefs, sce->coeffs, 1024);
|
||||
start = win*128;
|
||||
for (cb = 0; cb < CB_TOT_ALL; cb++) {
|
||||
path[0][cb].cost = 0.0f;
|
||||
@@ -200,7 +200,7 @@ static void set_special_band_scalefactors(AACEncContext *s, SingleChannelElement
|
||||
int bands = 0;
|
||||
|
||||
for (w = 0; w < sce->ics.num_windows; w += sce->ics.group_len[w]) {
|
||||
for (g = 0; g < sce->ics.num_swb; g++) {
|
||||
for (g = 0; g < sce->ics.num_swb; g++) {
|
||||
if (sce->zeroes[w*16+g])
|
||||
continue;
|
||||
if (sce->band_type[w*16+g] == INTENSITY_BT || sce->band_type[w*16+g] == INTENSITY_BT2) {
|
||||
@@ -220,7 +220,7 @@ static void set_special_band_scalefactors(AACEncContext *s, SingleChannelElement
|
||||
|
||||
/* Clip the scalefactor indices */
|
||||
for (w = 0; w < sce->ics.num_windows; w += sce->ics.group_len[w]) {
|
||||
for (g = 0; g < sce->ics.num_swb; g++) {
|
||||
for (g = 0; g < sce->ics.num_swb; g++) {
|
||||
if (sce->zeroes[w*16+g])
|
||||
continue;
|
||||
if (sce->band_type[w*16+g] == INTENSITY_BT || sce->band_type[w*16+g] == INTENSITY_BT2) {
|
||||
@@ -299,7 +299,7 @@ static void search_for_quantizers_anmr(AVCodecContext *avctx, AACEncContext *s,
|
||||
}
|
||||
}
|
||||
idx = 1;
|
||||
s->abs_pow34(s->scoefs, sce->coeffs, 1024);
|
||||
abs_pow34_v(s->scoefs, sce->coeffs, 1024);
|
||||
for (w = 0; w < sce->ics.num_windows; w += sce->ics.group_len[w]) {
|
||||
start = w*128;
|
||||
for (g = 0; g < sce->ics.num_swb; g++) {
|
||||
@@ -387,7 +387,7 @@ static void search_for_quantizers_anmr(AVCodecContext *avctx, AACEncContext *s,
|
||||
}
|
||||
//set the same quantizers inside window groups
|
||||
for (w = 0; w < sce->ics.num_windows; w += sce->ics.group_len[w])
|
||||
for (g = 0; g < sce->ics.num_swb; g++)
|
||||
for (g = 0; g < sce->ics.num_swb; g++)
|
||||
for (w2 = 1; w2 < sce->ics.group_len[w]; w2++)
|
||||
sce->sf_idx[(w+w2)*16+g] = sce->sf_idx[w*16+g];
|
||||
}
|
||||
@@ -396,148 +396,34 @@ static void search_for_quantizers_fast(AVCodecContext *avctx, AACEncContext *s,
|
||||
SingleChannelElement *sce,
|
||||
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);
|
||||
float dists[128] = { 0 }, uplims[128] = { 0 };
|
||||
float maxvals[128];
|
||||
int fflag, minscaler;
|
||||
int its = 0;
|
||||
int allz = 0;
|
||||
float minthr = INFINITY;
|
||||
int i, w, w2, g;
|
||||
int minq = 255;
|
||||
|
||||
// for values above this the decoder might end up in an endless loop
|
||||
// due to always having more bits than what can be encoded.
|
||||
destbits = FFMIN(destbits, 5800);
|
||||
//some heuristic to determine initial quantizers will reduce search time
|
||||
//determine zero bands and upper limits
|
||||
memset(sce->sf_idx, 0, sizeof(sce->sf_idx));
|
||||
for (w = 0; w < sce->ics.num_windows; w += sce->ics.group_len[w]) {
|
||||
start = 0;
|
||||
for (g = 0; g < sce->ics.num_swb; g++) {
|
||||
int nz = 0;
|
||||
float uplim = 0.0f, energy = 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) {
|
||||
if (band->energy <= band->threshold) {
|
||||
sce->sf_idx[(w+w2)*16+g] = 218;
|
||||
sce->zeroes[(w+w2)*16+g] = 1;
|
||||
continue;
|
||||
} else {
|
||||
sce->sf_idx[(w+w2)*16+g] = av_clip(SCALE_ONE_POS - SCALE_DIV_512 + log2f(band->threshold), 80, 218);
|
||||
sce->zeroes[(w+w2)*16+g] = 0;
|
||||
}
|
||||
nz = 1;
|
||||
minq = FFMIN(minq, sce->sf_idx[(w+w2)*16+g]);
|
||||
}
|
||||
uplims[w*16+g] = uplim *512;
|
||||
sce->band_type[w*16+g] = 0;
|
||||
sce->zeroes[w*16+g] = !nz;
|
||||
if (nz)
|
||||
minthr = FFMIN(minthr, uplim);
|
||||
allz |= nz;
|
||||
start += sce->ics.swb_sizes[g];
|
||||
}
|
||||
}
|
||||
for (w = 0; w < sce->ics.num_windows; w += sce->ics.group_len[w]) {
|
||||
for (g = 0; g < sce->ics.num_swb; g++) {
|
||||
if (sce->zeroes[w*16+g]) {
|
||||
sce->sf_idx[w*16+g] = SCALE_ONE_POS;
|
||||
continue;
|
||||
}
|
||||
sce->sf_idx[w*16+g] = SCALE_ONE_POS + FFMIN(log2f(uplims[w*16+g]/minthr)*4,59);
|
||||
}
|
||||
for (i = 0; i < 128; i++) {
|
||||
sce->sf_idx[i] = 140;
|
||||
//av_clip(sce->sf_idx[i], minq, minq + SCALE_MAX_DIFF - 1);
|
||||
}
|
||||
|
||||
if (!allz)
|
||||
return;
|
||||
s->abs_pow34(s->scoefs, sce->coeffs, 1024);
|
||||
ff_quantize_band_cost_cache_init(s);
|
||||
|
||||
for (w = 0; w < sce->ics.num_windows; w += sce->ics.group_len[w]) {
|
||||
start = w*128;
|
||||
for (g = 0; g < sce->ics.num_swb; g++) {
|
||||
const float *scaled = s->scoefs + start;
|
||||
maxvals[w*16+g] = find_max_val(sce->ics.group_len[w], sce->ics.swb_sizes[g], scaled);
|
||||
start += sce->ics.swb_sizes[g];
|
||||
}
|
||||
}
|
||||
|
||||
//perform two-loop search
|
||||
//outer loop - improve quality
|
||||
do {
|
||||
int tbits, qstep;
|
||||
minscaler = sce->sf_idx[0];
|
||||
//inner loop - quantize spectrum to fit into given number of bits
|
||||
qstep = its ? 1 : 32;
|
||||
do {
|
||||
int prev = -1;
|
||||
tbits = 0;
|
||||
for (w = 0; w < sce->ics.num_windows; w += sce->ics.group_len[w]) {
|
||||
start = w*128;
|
||||
for (g = 0; g < sce->ics.num_swb; g++) {
|
||||
const float *coefs = sce->coeffs + start;
|
||||
const float *scaled = s->scoefs + start;
|
||||
int bits = 0;
|
||||
int cb;
|
||||
float dist = 0.0f;
|
||||
|
||||
if (sce->zeroes[w*16+g] || sce->sf_idx[w*16+g] >= 218) {
|
||||
start += sce->ics.swb_sizes[g];
|
||||
continue;
|
||||
}
|
||||
minscaler = FFMIN(minscaler, sce->sf_idx[w*16+g]);
|
||||
cb = find_min_book(maxvals[w*16+g], sce->sf_idx[w*16+g]);
|
||||
for (w2 = 0; w2 < sce->ics.group_len[w]; w2++) {
|
||||
int b;
|
||||
dist += quantize_band_cost_cached(s, w + w2, g,
|
||||
coefs + w2*128,
|
||||
scaled + w2*128,
|
||||
sce->ics.swb_sizes[g],
|
||||
sce->sf_idx[w*16+g],
|
||||
cb, 1.0f, INFINITY,
|
||||
&b, NULL, 0);
|
||||
bits += b;
|
||||
}
|
||||
dists[w*16+g] = dist - bits;
|
||||
if (prev != -1) {
|
||||
bits += ff_aac_scalefactor_bits[sce->sf_idx[w*16+g] - prev + SCALE_DIFF_ZERO];
|
||||
}
|
||||
tbits += bits;
|
||||
start += sce->ics.swb_sizes[g];
|
||||
prev = sce->sf_idx[w*16+g];
|
||||
}
|
||||
}
|
||||
if (tbits > destbits) {
|
||||
for (i = 0; i < 128; i++)
|
||||
if (sce->sf_idx[i] < 218 - qstep)
|
||||
sce->sf_idx[i] += qstep;
|
||||
} else {
|
||||
for (i = 0; i < 128; i++)
|
||||
if (sce->sf_idx[i] > 60 - qstep)
|
||||
sce->sf_idx[i] -= qstep;
|
||||
}
|
||||
qstep >>= 1;
|
||||
if (!qstep && tbits > destbits*1.02 && sce->sf_idx[0] < 217)
|
||||
qstep = 1;
|
||||
} while (qstep);
|
||||
|
||||
fflag = 0;
|
||||
minscaler = av_clip(minscaler, 60, 255 - SCALE_MAX_DIFF);
|
||||
|
||||
for (w = 0; w < sce->ics.num_windows; w += sce->ics.group_len[w]) {
|
||||
for (g = 0; g < sce->ics.num_swb; g++) {
|
||||
int prevsc = sce->sf_idx[w*16+g];
|
||||
if (dists[w*16+g] > uplims[w*16+g] && sce->sf_idx[w*16+g] > 60) {
|
||||
if (find_min_book(maxvals[w*16+g], sce->sf_idx[w*16+g]-1))
|
||||
sce->sf_idx[w*16+g]--;
|
||||
else //Try to make sure there is some energy in every band
|
||||
sce->sf_idx[w*16+g]-=2;
|
||||
}
|
||||
sce->sf_idx[w*16+g] = av_clip(sce->sf_idx[w*16+g], minscaler, minscaler + SCALE_MAX_DIFF);
|
||||
sce->sf_idx[w*16+g] = FFMIN(sce->sf_idx[w*16+g], 219);
|
||||
if (sce->sf_idx[w*16+g] != prevsc)
|
||||
fflag = 1;
|
||||
sce->band_type[w*16+g] = find_min_book(maxvals[w*16+g], sce->sf_idx[w*16+g]);
|
||||
}
|
||||
}
|
||||
its++;
|
||||
} while (fflag && its < 10);
|
||||
//set the same quantizers inside window groups
|
||||
for (w = 0; w < sce->ics.num_windows; w += sce->ics.group_len[w])
|
||||
for (g = 0; g < sce->ics.num_swb; g++)
|
||||
for (w2 = 1; w2 < sce->ics.group_len[w]; w2++)
|
||||
sce->sf_idx[(w+w2)*16+g] = sce->sf_idx[w*16+g];
|
||||
}
|
||||
|
||||
static void search_for_pns(AACEncContext *s, AVCodecContext *avctx, SingleChannelElement *sce)
|
||||
@@ -581,7 +467,7 @@ static void search_for_pns(AACEncContext *s, AVCodecContext *avctx, SingleChanne
|
||||
ff_init_nextband_map(sce, nextband);
|
||||
for (w = 0; w < sce->ics.num_windows; w += sce->ics.group_len[w]) {
|
||||
int wstart = w*128;
|
||||
for (g = 0; g < sce->ics.num_swb; g++) {
|
||||
for (g = 0; g < sce->ics.num_swb; g++) {
|
||||
int noise_sfi;
|
||||
float dist1 = 0.0f, dist2 = 0.0f, noise_amp;
|
||||
float pns_energy = 0.0f, pns_tgt_energy, energy_ratio, dist_thresh;
|
||||
@@ -643,17 +529,19 @@ static void search_for_pns(AACEncContext *s, AVCodecContext *avctx, SingleChanne
|
||||
float band_energy, scale, pns_senergy;
|
||||
const int start_c = (w+w2)*128+sce->ics.swb_offset[g];
|
||||
band = &s->psy.ch[s->cur_channel].psy_bands[(w+w2)*16+g];
|
||||
for (i = 0; i < sce->ics.swb_sizes[g]; i++) {
|
||||
s->random_state = lcg_random(s->random_state);
|
||||
PNS[i] = s->random_state;
|
||||
for (i = 0; i < sce->ics.swb_sizes[g]; i+=2) {
|
||||
double rnd[2];
|
||||
av_bmg_get(&s->lfg, rnd);
|
||||
PNS[i+0] = (float)rnd[0];
|
||||
PNS[i+1] = (float)rnd[1];
|
||||
}
|
||||
band_energy = s->fdsp->scalarproduct_float(PNS, PNS, sce->ics.swb_sizes[g]);
|
||||
scale = noise_amp/sqrtf(band_energy);
|
||||
s->fdsp->vector_fmul_scalar(PNS, PNS, scale, sce->ics.swb_sizes[g]);
|
||||
pns_senergy = s->fdsp->scalarproduct_float(PNS, PNS, sce->ics.swb_sizes[g]);
|
||||
pns_energy += pns_senergy;
|
||||
s->abs_pow34(NOR34, &sce->coeffs[start_c], sce->ics.swb_sizes[g]);
|
||||
s->abs_pow34(PNS34, PNS, sce->ics.swb_sizes[g]);
|
||||
abs_pow34_v(NOR34, &sce->coeffs[start_c], sce->ics.swb_sizes[g]);
|
||||
abs_pow34_v(PNS34, PNS, sce->ics.swb_sizes[g]);
|
||||
dist1 += quantize_band_cost(s, &sce->coeffs[start_c],
|
||||
NOR34,
|
||||
sce->ics.swb_sizes[g],
|
||||
@@ -715,7 +603,7 @@ static void mark_pns(AACEncContext *s, AVCodecContext *avctx, SingleChannelEleme
|
||||
|
||||
memcpy(sce->band_alt, sce->band_type, sizeof(sce->band_type));
|
||||
for (w = 0; w < sce->ics.num_windows; w += sce->ics.group_len[w]) {
|
||||
for (g = 0; g < sce->ics.num_swb; g++) {
|
||||
for (g = 0; g < sce->ics.num_swb; g++) {
|
||||
float sfb_energy = 0.0f, threshold = 0.0f, spread = 2.0f;
|
||||
float min_energy = -1.0f, max_energy = 0.0f;
|
||||
const int start = sce->ics.swb_offset[g];
|
||||
@@ -757,9 +645,8 @@ static void search_for_ms(AACEncContext *s, ChannelElement *cpe)
|
||||
{
|
||||
int start = 0, i, w, w2, g, sid_sf_boost, prev_mid, prev_side;
|
||||
uint8_t nextband0[128], nextband1[128];
|
||||
float *M = s->scoefs + 128*0, *S = s->scoefs + 128*1;
|
||||
float *L34 = s->scoefs + 128*2, *R34 = s->scoefs + 128*3;
|
||||
float *M34 = s->scoefs + 128*4, *S34 = s->scoefs + 128*5;
|
||||
float M[128], S[128];
|
||||
float *L34 = s->scoefs, *R34 = s->scoefs + 128, *M34 = s->scoefs + 128*2, *S34 = s->scoefs + 128*3;
|
||||
const float lambda = s->lambda;
|
||||
const float mslambda = FFMIN(1.0f, lambda / 120.f);
|
||||
SingleChannelElement *sce0 = &cpe->ch[0];
|
||||
@@ -775,7 +662,7 @@ static void search_for_ms(AACEncContext *s, ChannelElement *cpe)
|
||||
prev_side = sce1->sf_idx[0];
|
||||
for (w = 0; w < sce0->ics.num_windows; w += sce0->ics.group_len[w]) {
|
||||
start = 0;
|
||||
for (g = 0; g < sce0->ics.num_swb; g++) {
|
||||
for (g = 0; g < sce0->ics.num_swb; g++) {
|
||||
float bmax = bval2bmax(g * 17.0f / sce0->ics.num_swb) / 0.0045f;
|
||||
if (!cpe->is_mask[w*16+g])
|
||||
cpe->ms_mask[w*16+g] = 0;
|
||||
@@ -790,8 +677,8 @@ static void search_for_ms(AACEncContext *s, ChannelElement *cpe)
|
||||
S[i] = M[i]
|
||||
- sce1->coeffs[start+(w+w2)*128+i];
|
||||
}
|
||||
s->abs_pow34(M34, M, sce0->ics.swb_sizes[g]);
|
||||
s->abs_pow34(S34, S, sce0->ics.swb_sizes[g]);
|
||||
abs_pow34_v(M34, M, sce0->ics.swb_sizes[g]);
|
||||
abs_pow34_v(S34, S, sce0->ics.swb_sizes[g]);
|
||||
for (i = 0; i < sce0->ics.swb_sizes[g]; i++ ) {
|
||||
Mmax = FFMAX(Mmax, M34[i]);
|
||||
Smax = FFMAX(Smax, S34[i]);
|
||||
@@ -834,10 +721,10 @@ static void search_for_ms(AACEncContext *s, ChannelElement *cpe)
|
||||
- sce1->coeffs[start+(w+w2)*128+i];
|
||||
}
|
||||
|
||||
s->abs_pow34(L34, sce0->coeffs+start+(w+w2)*128, sce0->ics.swb_sizes[g]);
|
||||
s->abs_pow34(R34, sce1->coeffs+start+(w+w2)*128, sce0->ics.swb_sizes[g]);
|
||||
s->abs_pow34(M34, M, sce0->ics.swb_sizes[g]);
|
||||
s->abs_pow34(S34, S, sce0->ics.swb_sizes[g]);
|
||||
abs_pow34_v(L34, sce0->coeffs+start+(w+w2)*128, sce0->ics.swb_sizes[g]);
|
||||
abs_pow34_v(R34, sce1->coeffs+start+(w+w2)*128, sce0->ics.swb_sizes[g]);
|
||||
abs_pow34_v(M34, M, sce0->ics.swb_sizes[g]);
|
||||
abs_pow34_v(S34, S, sce0->ics.swb_sizes[g]);
|
||||
dist1 += quantize_band_cost(s, &sce0->coeffs[start + (w+w2)*128],
|
||||
L34,
|
||||
sce0->ics.swb_sizes[g],
|
||||
@@ -941,7 +828,7 @@ AACCoefficientsEncoder ff_aac_coders[AAC_CODER_NB] = {
|
||||
},
|
||||
[AAC_CODER_FAST] = {
|
||||
search_for_quantizers_fast,
|
||||
codebook_trellis_rate,
|
||||
encode_window_bands_info,
|
||||
quantize_and_encode_band,
|
||||
ff_aac_encode_tns_info,
|
||||
ff_aac_encode_ltp_info,
|
||||
|
||||
@@ -70,7 +70,7 @@ static void codebook_trellis_rate(AACEncContext *s, SingleChannelElement *sce,
|
||||
float next_minbits = INFINITY;
|
||||
int next_mincb = 0;
|
||||
|
||||
s->abs_pow34(s->scoefs, sce->coeffs, 1024);
|
||||
abs_pow34_v(s->scoefs, sce->coeffs, 1024);
|
||||
start = win*128;
|
||||
for (cb = 0; cb < CB_TOT_ALL; cb++) {
|
||||
path[0][cb].cost = run_bits+4;
|
||||
|
||||
@@ -77,7 +77,7 @@ static void search_for_quantizers_twoloop(AVCodecContext *avctx,
|
||||
int toomanybits, toofewbits;
|
||||
char nzs[128];
|
||||
uint8_t nextband[128];
|
||||
int maxsf[128], minsf[128];
|
||||
int maxsf[128];
|
||||
float dists[128] = { 0 }, qenergies[128] = { 0 }, uplims[128], euplims[128], energies[128];
|
||||
float maxvals[128], spread_thr_r[128];
|
||||
float min_spread_thr_r, max_spread_thr_r;
|
||||
@@ -87,7 +87,7 @@ static void search_for_quantizers_twoloop(AVCodecContext *avctx,
|
||||
* will keep iterating until it fails to lower it or it reaches
|
||||
* ulimit * rdlambda. Keeping it low increases quality on difficult
|
||||
* signals, but lower it too much, and bits will be taken from weak
|
||||
* signals, creating "holes". A balance is necessary.
|
||||
* signals, creating "holes". A balance is necesary.
|
||||
* rdmax and rdmin specify the relative deviation from rdlambda
|
||||
* allowed for tonality compensation
|
||||
*/
|
||||
@@ -291,22 +291,14 @@ static void search_for_quantizers_twoloop(AVCodecContext *avctx,
|
||||
|
||||
if (!allz)
|
||||
return;
|
||||
s->abs_pow34(s->scoefs, sce->coeffs, 1024);
|
||||
abs_pow34_v(s->scoefs, sce->coeffs, 1024);
|
||||
ff_quantize_band_cost_cache_init(s);
|
||||
|
||||
for (i = 0; i < sizeof(minsf) / sizeof(minsf[0]); ++i)
|
||||
minsf[i] = 0;
|
||||
for (w = 0; w < sce->ics.num_windows; w += sce->ics.group_len[w]) {
|
||||
start = w*128;
|
||||
for (g = 0; g < sce->ics.num_swb; g++) {
|
||||
const float *scaled = s->scoefs + start;
|
||||
int minsfidx;
|
||||
maxvals[w*16+g] = find_max_val(sce->ics.group_len[w], sce->ics.swb_sizes[g], scaled);
|
||||
if (maxvals[w*16+g] > 0) {
|
||||
minsfidx = coef2minsf(maxvals[w*16+g]);
|
||||
for (w2 = 0; w2 < sce->ics.group_len[w]; w2++)
|
||||
minsf[(w+w2)*16+g] = minsfidx;
|
||||
}
|
||||
start += sce->ics.swb_sizes[g];
|
||||
}
|
||||
}
|
||||
@@ -433,7 +425,7 @@ static void search_for_quantizers_twoloop(AVCodecContext *avctx,
|
||||
recomprd = 1;
|
||||
for (i = 0; i < 128; i++) {
|
||||
if (sce->sf_idx[i] > SCALE_ONE_POS) {
|
||||
int new_sf = FFMAX3(minsf[i], SCALE_ONE_POS, sce->sf_idx[i] - qstep);
|
||||
int new_sf = FFMAX(SCALE_ONE_POS, sce->sf_idx[i] - qstep);
|
||||
if (new_sf != sce->sf_idx[i]) {
|
||||
sce->sf_idx[i] = new_sf;
|
||||
changed = 1;
|
||||
@@ -603,7 +595,7 @@ static void search_for_quantizers_twoloop(AVCodecContext *avctx,
|
||||
int cmb = find_min_book(maxvals[w*16+g], sce->sf_idx[w*16+g]);
|
||||
int mindeltasf = FFMAX(0, prev - SCALE_MAX_DIFF);
|
||||
int maxdeltasf = FFMIN(SCALE_MAX_POS - SCALE_DIV_512, prev + SCALE_MAX_DIFF);
|
||||
if ((!cmb || dists[w*16+g] > uplims[w*16+g]) && sce->sf_idx[w*16+g] > FFMAX(mindeltasf, minsf[w*16+g])) {
|
||||
if ((!cmb || dists[w*16+g] > uplims[w*16+g]) && sce->sf_idx[w*16+g] > mindeltasf) {
|
||||
/* Try to make sure there is some energy in every nonzero band
|
||||
* NOTE: This algorithm must be forcibly imbalanced, pushing harder
|
||||
* on holes or more distorted bands at first, otherwise there's
|
||||
|
||||
@@ -50,7 +50,7 @@
|
||||
#include "aac.h"
|
||||
#include "aactab.h"
|
||||
#include "aacdectab.h"
|
||||
#include "cbrt_data.h"
|
||||
#include "cbrt_tablegen.h"
|
||||
#include "sbr.h"
|
||||
#include "aacsbr.h"
|
||||
#include "mpeg4audio.h"
|
||||
|
||||
@@ -75,7 +75,7 @@
|
||||
#include "aac.h"
|
||||
#include "aactab.h"
|
||||
#include "aacdectab.h"
|
||||
#include "cbrt_data.h"
|
||||
#include "cbrt_tablegen.h"
|
||||
#include "sbr.h"
|
||||
#include "aacsbr.h"
|
||||
#include "mpeg4audio.h"
|
||||
@@ -155,9 +155,9 @@ static void vector_pow43(int *coefs, int len)
|
||||
for (i=0; i<len; i++) {
|
||||
coef = coefs[i];
|
||||
if (coef < 0)
|
||||
coef = -(int)ff_cbrt_tab_fixed[-coef];
|
||||
coef = -(int)cbrt_tab[-coef];
|
||||
else
|
||||
coef = (int)ff_cbrt_tab_fixed[coef];
|
||||
coef = (int)cbrt_tab[coef];
|
||||
coefs[i] = coef;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1104,7 +1104,7 @@ static av_cold void aac_static_table_init(void)
|
||||
AAC_RENAME(ff_init_ff_sine_windows)( 9);
|
||||
AAC_RENAME(ff_init_ff_sine_windows)( 7);
|
||||
|
||||
AAC_RENAME(ff_cbrt_tableinit)();
|
||||
AAC_RENAME(cbrt_tableinit)();
|
||||
}
|
||||
|
||||
static AVOnce aac_table_init = AV_ONCE_INIT;
|
||||
@@ -1795,7 +1795,7 @@ static int decode_spectrum_and_dequant(AACContext *ac, INTFLOAT coef[1024],
|
||||
v = -v;
|
||||
*icf++ = v;
|
||||
#else
|
||||
*icf++ = ff_cbrt_tab[n] | (bits & 1U<<31);
|
||||
*icf++ = cbrt_tab[n] | (bits & 1U<<31);
|
||||
#endif /* USE_FIXED */
|
||||
bits <<= 1;
|
||||
} else {
|
||||
|
||||
@@ -78,10 +78,11 @@ static void put_audio_specific_config(AVCodecContext *avctx)
|
||||
|
||||
void ff_quantize_band_cost_cache_init(struct AACEncContext *s)
|
||||
{
|
||||
++s->quantize_band_cost_cache_generation;
|
||||
if (s->quantize_band_cost_cache_generation == 0) {
|
||||
memset(s->quantize_band_cost_cache, 0, sizeof(s->quantize_band_cost_cache));
|
||||
s->quantize_band_cost_cache_generation = 1;
|
||||
int sf, g;
|
||||
for (sf = 0; sf < 256; sf++) {
|
||||
for (g = 0; g < 128; g++) {
|
||||
s->quantize_band_cost_cache[sf][g].bits = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -554,11 +555,10 @@ static int aac_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
|
||||
if (!frame)
|
||||
la = NULL;
|
||||
if (tag == TYPE_LFE) {
|
||||
wi[ch].window_type[0] = wi[ch].window_type[1] = ONLY_LONG_SEQUENCE;
|
||||
wi[ch].window_type[0] = ONLY_LONG_SEQUENCE;
|
||||
wi[ch].window_shape = 0;
|
||||
wi[ch].num_windows = 1;
|
||||
wi[ch].grouping[0] = 1;
|
||||
wi[ch].clipping[0] = 0;
|
||||
|
||||
/* Only the lowest 12 coefficients are used in a LFE channel.
|
||||
* The expression below results in only the bottom 8 coefficients
|
||||
@@ -583,22 +583,9 @@ static int aac_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
|
||||
ics->tns_max_bands = wi[ch].window_type[0] == EIGHT_SHORT_SEQUENCE ?
|
||||
ff_tns_max_bands_128 [s->samplerate_index]:
|
||||
ff_tns_max_bands_1024[s->samplerate_index];
|
||||
|
||||
clip_avoidance_factor = 0.0f;
|
||||
for (w = 0; w < ics->num_windows; w++)
|
||||
ics->group_len[w] = wi[ch].grouping[w];
|
||||
|
||||
/* Calculate input sample maximums and evaluate clipping risk */
|
||||
clip_avoidance_factor = 0.0f;
|
||||
for (w = 0; w < ics->num_windows; w++) {
|
||||
const float *wbuf = overlap + w * 128;
|
||||
const int wlen = 2048 / ics->num_windows;
|
||||
float max = 0;
|
||||
int j;
|
||||
/* mdct input is 2 * output */
|
||||
for (j = 0; j < wlen; j++)
|
||||
max = FFMAX(max, fabsf(wbuf[j]));
|
||||
wi[ch].clipping[w] = max;
|
||||
}
|
||||
for (w = 0; w < ics->num_windows; w++) {
|
||||
if (wi[ch].clipping[w] > CLIP_AVOIDANCE_FACTOR) {
|
||||
ics->window_clipping[w] = 1;
|
||||
@@ -622,8 +609,8 @@ static int aac_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
|
||||
}
|
||||
|
||||
for (k = 0; k < 1024; k++) {
|
||||
if (!(fabs(cpe->ch[ch].coeffs[k]) < 1E16)) { // Ensure headroom for energy calculation
|
||||
av_log(avctx, AV_LOG_ERROR, "Input contains (near) NaN/+-Inf\n");
|
||||
if (!isfinite(cpe->ch[ch].coeffs[k])) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Input contains NaN/+-Inf\n");
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
}
|
||||
@@ -999,9 +986,9 @@ static av_cold int aac_encode_init(AVCodecContext *avctx)
|
||||
|
||||
/* Coder limitations */
|
||||
s->coder = &ff_aac_coders[s->options.coder];
|
||||
if (s->options.coder == AAC_CODER_ANMR) {
|
||||
if (s->options.coder != AAC_CODER_TWOLOOP) {
|
||||
ERROR_IF(avctx->strict_std_compliance > FF_COMPLIANCE_EXPERIMENTAL,
|
||||
"The ANMR coder is considered experimental, add -strict -2 to enable!\n");
|
||||
"Coders other than twoloop require -strict -2 and some may be removed in the future\n");
|
||||
s->options.intensity_stereo = 0;
|
||||
s->options.pns = 0;
|
||||
}
|
||||
@@ -1031,13 +1018,7 @@ static av_cold int aac_encode_init(AVCodecContext *avctx)
|
||||
goto fail;
|
||||
s->psypp = ff_psy_preprocess_init(avctx);
|
||||
ff_lpc_init(&s->lpc, 2*avctx->frame_size, TNS_MAX_ORDER, FF_LPC_TYPE_LEVINSON);
|
||||
s->random_state = 0x1f2e3d4c;
|
||||
|
||||
s->abs_pow34 = abs_pow34_v;
|
||||
s->quant_bands = quantize_bands;
|
||||
|
||||
if (ARCH_X86)
|
||||
ff_aac_dsp_init_x86(s);
|
||||
av_lfg_init(&s->lfg, 0x72adca55);
|
||||
|
||||
if (HAVE_MIPSDSP)
|
||||
ff_aac_coder_init_mips(s);
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#define AVCODEC_AACENC_H
|
||||
|
||||
#include "libavutil/float_dsp.h"
|
||||
#include "libavutil/lfg.h"
|
||||
#include "avcodec.h"
|
||||
#include "put_bits.h"
|
||||
|
||||
@@ -83,10 +84,10 @@ extern AACCoefficientsEncoder ff_aac_coders[];
|
||||
typedef struct AACQuantizeBandCostCacheEntry {
|
||||
float rd;
|
||||
float energy;
|
||||
int bits;
|
||||
int bits; ///< -1 means uninitialized entry
|
||||
char cb;
|
||||
char rtz;
|
||||
uint16_t generation;
|
||||
char padding[2]; ///< Keeps the entry size a multiple of 32 bits
|
||||
} AACQuantizeBandCostCacheEntry;
|
||||
|
||||
/**
|
||||
@@ -99,6 +100,7 @@ typedef struct AACEncContext {
|
||||
FFTContext mdct1024; ///< long (1024 samples) frame transform context
|
||||
FFTContext mdct128; ///< short (128 samples) frame transform context
|
||||
AVFloatDSPContext *fdsp;
|
||||
AVLFG lfg; ///< PRNG needed for PNS
|
||||
float *planar_samples[8]; ///< saved preprocessed input
|
||||
|
||||
int profile; ///< copied from avctx
|
||||
@@ -124,20 +126,13 @@ typedef struct AACEncContext {
|
||||
DECLARE_ALIGNED(16, int, qcoefs)[96]; ///< quantized coefficients
|
||||
DECLARE_ALIGNED(32, float, scoefs)[1024]; ///< scaled coefficients
|
||||
|
||||
uint16_t quantize_band_cost_cache_generation;
|
||||
AACQuantizeBandCostCacheEntry quantize_band_cost_cache[256][128]; ///< memoization area for quantize_band_cost
|
||||
|
||||
void (*abs_pow34)(float *out, const float *in, const int size);
|
||||
void (*quant_bands)(int *out, const float *in, const float *scaled,
|
||||
int size, int is_signed, int maxval, const float Q34,
|
||||
const float rounding);
|
||||
|
||||
struct {
|
||||
float *samples;
|
||||
} buffer;
|
||||
} AACEncContext;
|
||||
|
||||
void ff_aac_dsp_init_x86(AACEncContext *s);
|
||||
void ff_aac_coder_init_mips(AACEncContext *c);
|
||||
void ff_quantize_band_cost_cache_init(struct AACEncContext *s);
|
||||
|
||||
|
||||
@@ -59,9 +59,9 @@ struct AACISError ff_aac_is_encoding_err(AACEncContext *s, ChannelElement *cpe,
|
||||
float minthr = FFMIN(band0->threshold, band1->threshold);
|
||||
for (i = 0; i < sce0->ics.swb_sizes[g]; i++)
|
||||
IS[i] = (L[start+(w+w2)*128+i] + phase*R[start+(w+w2)*128+i])*sqrt(ener0/ener01);
|
||||
s->abs_pow34(L34, &L[start+(w+w2)*128], sce0->ics.swb_sizes[g]);
|
||||
s->abs_pow34(R34, &R[start+(w+w2)*128], sce0->ics.swb_sizes[g]);
|
||||
s->abs_pow34(I34, IS, sce0->ics.swb_sizes[g]);
|
||||
abs_pow34_v(L34, &L[start+(w+w2)*128], sce0->ics.swb_sizes[g]);
|
||||
abs_pow34_v(R34, &R[start+(w+w2)*128], sce0->ics.swb_sizes[g]);
|
||||
abs_pow34_v(I34, IS, sce0->ics.swb_sizes[g]);
|
||||
maxval = find_max_val(1, sce0->ics.swb_sizes[g], I34);
|
||||
is_band_type = find_min_book(maxval, is_sf_idx);
|
||||
dist1 += quantize_band_cost(s, &L[start + (w+w2)*128], L34,
|
||||
|
||||
@@ -190,8 +190,8 @@ void ff_aac_search_for_ltp(AACEncContext *s, SingleChannelElement *sce,
|
||||
FFPsyBand *band = &s->psy.ch[s->cur_channel].psy_bands[(w+w2)*16+g];
|
||||
for (i = 0; i < sce->ics.swb_sizes[g]; i++)
|
||||
PCD[i] = sce->coeffs[start+(w+w2)*128+i] - sce->lcoeffs[start+(w+w2)*128+i];
|
||||
s->abs_pow34(C34, &sce->coeffs[start+(w+w2)*128], sce->ics.swb_sizes[g]);
|
||||
s->abs_pow34(PCD34, PCD, sce->ics.swb_sizes[g]);
|
||||
abs_pow34_v(C34, &sce->coeffs[start+(w+w2)*128], sce->ics.swb_sizes[g]);
|
||||
abs_pow34_v(PCD34, PCD, sce->ics.swb_sizes[g]);
|
||||
dist1 += quantize_band_cost(s, &sce->coeffs[start+(w+w2)*128], C34, sce->ics.swb_sizes[g],
|
||||
sce->sf_idx[(w+w2)*16+g], sce->band_type[(w+w2)*16+g],
|
||||
s->lambda/band->threshold, INFINITY, &bits_tmp1, NULL, 0);
|
||||
|
||||
@@ -270,7 +270,7 @@ void ff_aac_search_for_pred(AACEncContext *s, SingleChannelElement *sce)
|
||||
continue;
|
||||
|
||||
/* Normal coefficients */
|
||||
s->abs_pow34(O34, &sce->coeffs[start_coef], num_coeffs);
|
||||
abs_pow34_v(O34, &sce->coeffs[start_coef], num_coeffs);
|
||||
dist1 = quantize_and_encode_band_cost(s, NULL, &sce->coeffs[start_coef], NULL,
|
||||
O34, num_coeffs, sce->sf_idx[sfb],
|
||||
cb_n, s->lambda / band->threshold, INFINITY, &cost1, NULL, 0);
|
||||
@@ -279,7 +279,7 @@ void ff_aac_search_for_pred(AACEncContext *s, SingleChannelElement *sce)
|
||||
/* Encoded coefficients - needed for #bits, band type and quant. error */
|
||||
for (i = 0; i < num_coeffs; i++)
|
||||
SENT[i] = sce->coeffs[start_coef + i] - sce->prcoeffs[start_coef + i];
|
||||
s->abs_pow34(S34, SENT, num_coeffs);
|
||||
abs_pow34_v(S34, SENT, num_coeffs);
|
||||
if (cb_n < RESERVED_BT)
|
||||
cb_p = av_clip(find_min_book(find_max_val(1, num_coeffs, S34), sce->sf_idx[sfb]), cb_min, cb_max);
|
||||
else
|
||||
@@ -291,7 +291,7 @@ void ff_aac_search_for_pred(AACEncContext *s, SingleChannelElement *sce)
|
||||
/* Reconstructed coefficients - needed for distortion measurements */
|
||||
for (i = 0; i < num_coeffs; i++)
|
||||
sce->prcoeffs[start_coef + i] += QERR[i] != 0.0f ? (sce->prcoeffs[start_coef + i] - QERR[i]) : 0.0f;
|
||||
s->abs_pow34(P34, &sce->prcoeffs[start_coef], num_coeffs);
|
||||
abs_pow34_v(P34, &sce->prcoeffs[start_coef], num_coeffs);
|
||||
if (cb_n < RESERVED_BT)
|
||||
cb_p = av_clip(find_min_book(find_max_val(1, num_coeffs, P34), sce->sf_idx[sfb]), cb_min, cb_max);
|
||||
else
|
||||
|
||||
@@ -74,10 +74,10 @@ static av_always_inline float quantize_and_encode_band_cost_template(
|
||||
return cost * lambda;
|
||||
}
|
||||
if (!scaled) {
|
||||
s->abs_pow34(s->scoefs, in, size);
|
||||
abs_pow34_v(s->scoefs, in, size);
|
||||
scaled = s->scoefs;
|
||||
}
|
||||
s->quant_bands(s->qcoefs, in, scaled, size, !BT_UNSIGNED, aac_cb_maxval[cb], Q34, ROUNDING);
|
||||
quantize_bands(s->qcoefs, in, scaled, size, Q34, !BT_UNSIGNED, aac_cb_maxval[cb], ROUNDING);
|
||||
if (BT_UNSIGNED) {
|
||||
off = 0;
|
||||
} else {
|
||||
|
||||
@@ -36,12 +36,11 @@ static inline float quantize_band_cost_cached(struct AACEncContext *s, int w, in
|
||||
AACQuantizeBandCostCacheEntry *entry;
|
||||
av_assert1(scale_idx >= 0 && scale_idx < 256);
|
||||
entry = &s->quantize_band_cost_cache[scale_idx][w*16+g];
|
||||
if (entry->generation != s->quantize_band_cost_cache_generation || entry->cb != cb || entry->rtz != rtz) {
|
||||
if (entry->bits < 0 || entry->cb != cb || entry->rtz != rtz) {
|
||||
entry->rd = quantize_band_cost(s, in, scaled, size, scale_idx,
|
||||
cb, lambda, uplim, &entry->bits, &entry->energy, rtz);
|
||||
entry->cb = cb;
|
||||
entry->rtz = rtz;
|
||||
entry->generation = s->quantize_band_cost_cache_generation;
|
||||
}
|
||||
if (bits)
|
||||
*bits = entry->bits;
|
||||
|
||||
@@ -28,7 +28,6 @@
|
||||
#ifndef AVCODEC_AACENC_UTILS_H
|
||||
#define AVCODEC_AACENC_UTILS_H
|
||||
|
||||
#include "libavutil/ffmath.h"
|
||||
#include "aac.h"
|
||||
#include "aacenctab.h"
|
||||
#include "aactab.h"
|
||||
@@ -63,17 +62,17 @@ static inline int quant(float coef, const float Q, const float rounding)
|
||||
}
|
||||
|
||||
static inline void quantize_bands(int *out, const float *in, const float *scaled,
|
||||
int size, int is_signed, int maxval, const float Q34,
|
||||
int size, float Q34, int is_signed, int maxval,
|
||||
const float rounding)
|
||||
{
|
||||
int i;
|
||||
double qc;
|
||||
for (i = 0; i < size; i++) {
|
||||
float qc = scaled[i] * Q34;
|
||||
int tmp = (int)FFMIN(qc + rounding, (float)maxval);
|
||||
qc = scaled[i] * Q34;
|
||||
out[i] = (int)FFMIN(qc + rounding, (double)maxval);
|
||||
if (is_signed && in[i] < 0.0f) {
|
||||
tmp = -tmp;
|
||||
out[i] = -out[i];
|
||||
}
|
||||
out[i] = tmp;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -91,7 +90,8 @@ static inline float find_max_val(int group_len, int swb_size, const float *scale
|
||||
|
||||
static inline int find_min_book(float maxval, int sf)
|
||||
{
|
||||
float Q34 = ff_aac_pow34sf_tab[POW_SF2_ZERO - sf + SCALE_ONE_POS - SCALE_DIV_512];
|
||||
float Q = ff_aac_pow2sf_tab[POW_SF2_ZERO - sf + SCALE_ONE_POS - SCALE_DIV_512];
|
||||
float Q34 = sqrtf(Q * sqrtf(Q));
|
||||
int qmaxval, cb;
|
||||
qmaxval = maxval * Q34 + C_QUANT;
|
||||
if (qmaxval >= (FF_ARRAY_ELEMS(aac_maxval_cb)))
|
||||
@@ -123,10 +123,7 @@ static inline float find_form_factor(int group_len, int swb_size, float thresh,
|
||||
if (s >= ethresh) {
|
||||
nzl += 1.0f;
|
||||
} else {
|
||||
if (nzslope == 2.f)
|
||||
nzl += (s / ethresh) * (s / ethresh);
|
||||
else
|
||||
nzl += ff_fast_powf(s / ethresh, nzslope);
|
||||
nzl += powf(s / ethresh, nzslope);
|
||||
}
|
||||
}
|
||||
if (e2 > thresh) {
|
||||
@@ -252,19 +249,6 @@ static inline int ff_sfdelta_can_replace(const SingleChannelElement *sce,
|
||||
&& sce->sf_idx[nextband[band]] <= (new_sf + SCALE_MAX_DIFF);
|
||||
}
|
||||
|
||||
/**
|
||||
* linear congruential pseudorandom number generator
|
||||
*
|
||||
* @param previous_val pointer to the current state of the generator
|
||||
*
|
||||
* @return Returns a 32-bit pseudorandom integer
|
||||
*/
|
||||
static av_always_inline int lcg_random(unsigned previous_val)
|
||||
{
|
||||
union { unsigned u; int s; } v = { previous_val * 1664525u + 1013904223 };
|
||||
return v.s;
|
||||
}
|
||||
|
||||
#define ERROR_IF(cond, ...) \
|
||||
if (cond) { \
|
||||
av_log(avctx, AV_LOG_ERROR, __VA_ARGS__); \
|
||||
|
||||
@@ -25,7 +25,8 @@
|
||||
*/
|
||||
|
||||
#include "libavutil/attributes.h"
|
||||
#include "libavutil/ffmath.h"
|
||||
#include "libavutil/internal.h"
|
||||
#include "libavutil/libm.h"
|
||||
|
||||
#include "avcodec.h"
|
||||
#include "aactab.h"
|
||||
@@ -685,7 +686,7 @@ static void psy_3gpp_analyze_channel(FFPsyContext *ctx, int channel,
|
||||
|
||||
band->thr_quiet = band->thr = FFMAX(band->thr, coeffs[g].ath);
|
||||
//5.4.2.5 "Pre-echo control"
|
||||
if (!(wi->window_type[0] == LONG_STOP_SEQUENCE || (!w && wi->window_type[1] == LONG_START_SEQUENCE)))
|
||||
if (!(wi->window_type[0] == LONG_STOP_SEQUENCE || (wi->window_type[1] == LONG_START_SEQUENCE && !w)))
|
||||
band->thr = FFMAX(PSY_3GPP_RPEMIN*band->thr, FFMIN(band->thr,
|
||||
PSY_3GPP_RPELEV*pch->prev_band[w+g].thr_quiet));
|
||||
|
||||
@@ -885,12 +886,13 @@ static FFPsyWindowInfo psy_lame_window(FFPsyContext *ctx, const float *audio,
|
||||
int grouping = 0;
|
||||
int uselongblock = 1;
|
||||
int attacks[AAC_NUM_BLOCKS_SHORT + 1] = { 0 };
|
||||
float clippings[AAC_NUM_BLOCKS_SHORT];
|
||||
int i;
|
||||
FFPsyWindowInfo wi = { { 0 } };
|
||||
|
||||
if (la) {
|
||||
float hpfsmpl[AAC_BLOCK_SIZE_LONG];
|
||||
const float *pf = hpfsmpl;
|
||||
float const *pf = hpfsmpl;
|
||||
float attack_intensity[(AAC_NUM_BLOCKS_SHORT + 1) * PSY_LAME_NUM_SUBBLOCKS];
|
||||
float energy_subshort[(AAC_NUM_BLOCKS_SHORT + 1) * PSY_LAME_NUM_SUBBLOCKS];
|
||||
float energy_short[AAC_NUM_BLOCKS_SHORT + 1] = { 0 };
|
||||
@@ -909,7 +911,7 @@ static FFPsyWindowInfo psy_lame_window(FFPsyContext *ctx, const float *audio,
|
||||
}
|
||||
|
||||
for (i = 0; i < AAC_NUM_BLOCKS_SHORT * PSY_LAME_NUM_SUBBLOCKS; i++) {
|
||||
const float *const pfe = pf + AAC_BLOCK_SIZE_LONG / (AAC_NUM_BLOCKS_SHORT * PSY_LAME_NUM_SUBBLOCKS);
|
||||
float const *const pfe = pf + AAC_BLOCK_SIZE_LONG / (AAC_NUM_BLOCKS_SHORT * PSY_LAME_NUM_SUBBLOCKS);
|
||||
float p = 1.0f;
|
||||
for (; pf < pfe; pf++)
|
||||
p = FFMAX(p, fabsf(*pf));
|
||||
@@ -942,9 +944,9 @@ static FFPsyWindowInfo psy_lame_window(FFPsyContext *ctx, const float *audio,
|
||||
/* GB: tuned (1) to avoid too many short blocks for test sample TRUMPET */
|
||||
/* RH: tuned (2) to let enough short blocks through for test sample FSOL and SNAPS */
|
||||
for (i = 1; i < AAC_NUM_BLOCKS_SHORT + 1; i++) {
|
||||
const float u = energy_short[i - 1];
|
||||
const float v = energy_short[i];
|
||||
const float m = FFMAX(u, v);
|
||||
float const u = energy_short[i - 1];
|
||||
float const v = energy_short[i];
|
||||
float const m = FFMAX(u, v);
|
||||
if (m < 40000) { /* (2) */
|
||||
if (u < 1.7f * v && v < 1.7f * u) { /* (1) */
|
||||
if (i == 1 && attacks[0] < attacks[i])
|
||||
@@ -974,8 +976,24 @@ static FFPsyWindowInfo psy_lame_window(FFPsyContext *ctx, const float *audio,
|
||||
|
||||
lame_apply_block_type(pch, &wi, uselongblock);
|
||||
|
||||
/* Calculate input sample maximums and evaluate clipping risk */
|
||||
if (audio) {
|
||||
for (i = 0; i < AAC_NUM_BLOCKS_SHORT; i++) {
|
||||
const float *wbuf = audio + i * AAC_BLOCK_SIZE_SHORT;
|
||||
float max = 0;
|
||||
int j;
|
||||
for (j = 0; j < AAC_BLOCK_SIZE_SHORT; j++)
|
||||
max = FFMAX(max, fabsf(wbuf[j]));
|
||||
clippings[i] = max;
|
||||
}
|
||||
} else {
|
||||
for (i = 0; i < 8; i++)
|
||||
clippings[i] = 0;
|
||||
}
|
||||
|
||||
wi.window_type[1] = prev_type;
|
||||
if (wi.window_type[0] != EIGHT_SHORT_SEQUENCE) {
|
||||
float clipping = 0.0f;
|
||||
|
||||
wi.num_windows = 1;
|
||||
wi.grouping[0] = 1;
|
||||
@@ -984,6 +1002,9 @@ static FFPsyWindowInfo psy_lame_window(FFPsyContext *ctx, const float *audio,
|
||||
else
|
||||
wi.window_shape = 1;
|
||||
|
||||
for (i = 0; i < 8; i++)
|
||||
clipping = FFMAX(clipping, clippings[i]);
|
||||
wi.clipping[0] = clipping;
|
||||
} else {
|
||||
int lastgrp = 0;
|
||||
|
||||
@@ -994,6 +1015,14 @@ static FFPsyWindowInfo psy_lame_window(FFPsyContext *ctx, const float *audio,
|
||||
lastgrp = i;
|
||||
wi.grouping[lastgrp]++;
|
||||
}
|
||||
|
||||
for (i = 0; i < 8; i += wi.grouping[i]) {
|
||||
int w;
|
||||
float clipping = 0.0f;
|
||||
for (w = 0; w < wi.grouping[i] && !clipping; w++)
|
||||
clipping = FFMAX(clipping, clippings[i+w]);
|
||||
wi.clipping[i] = clipping;
|
||||
}
|
||||
}
|
||||
|
||||
/* Determine grouping, based on the location of the first attack, and save for
|
||||
|
||||
@@ -1473,7 +1473,7 @@ void AAC_RENAME(ff_sbr_apply)(AACContext *ac, SpectralBandReplication *sbr, int
|
||||
int err;
|
||||
|
||||
if (id_aac != sbr->id_aac) {
|
||||
av_log(ac->avctx, id_aac == TYPE_LFE ? AV_LOG_VERBOSE : AV_LOG_WARNING,
|
||||
av_log(ac->avctx, AV_LOG_ERROR,
|
||||
"element type mismatch %d != %d\n", id_aac, sbr->id_aac);
|
||||
sbr_turnoff(sbr);
|
||||
}
|
||||
|
||||
@@ -92,8 +92,8 @@ static inline void ff_aac_tableinit(void)
|
||||
* Table of the LTP coefficients
|
||||
*/
|
||||
static const INTFLOAT ltp_coef[8] = {
|
||||
Q30(0.570829), Q30(0.696616), Q30(0.813004), Q30(0.911304),
|
||||
Q30(0.984900), Q30(1.067894), Q30(1.194601), Q30(1.369533),
|
||||
Q30(0.570829f), Q30(0.696616f), Q30(0.813004f), Q30(0.911304f),
|
||||
Q30(0.984900f), Q30(1.067894f), Q30(1.194601f), Q30(1.369533f),
|
||||
};
|
||||
|
||||
/* @name tns_tmp2_map
|
||||
@@ -103,24 +103,24 @@ static const INTFLOAT ltp_coef[8] = {
|
||||
* @{
|
||||
*/
|
||||
static const INTFLOAT tns_tmp2_map_1_3[4] = {
|
||||
Q31(0.00000000), Q31(-0.43388373), Q31(0.64278758), Q31(0.34202015),
|
||||
Q31(0.00000000f), Q31(-0.43388373f), Q31(0.64278758f), Q31(0.34202015f),
|
||||
};
|
||||
|
||||
static const INTFLOAT tns_tmp2_map_0_3[8] = {
|
||||
Q31(0.00000000), Q31(-0.43388373), Q31(-0.78183150), Q31(-0.97492790),
|
||||
Q31(0.98480773), Q31( 0.86602539), Q31( 0.64278758), Q31( 0.34202015),
|
||||
Q31(0.00000000f), Q31(-0.43388373f), Q31(-0.78183150f), Q31(-0.97492790f),
|
||||
Q31(0.98480773f), Q31( 0.86602539f), Q31( 0.64278758f), Q31( 0.34202015f),
|
||||
};
|
||||
|
||||
static const INTFLOAT tns_tmp2_map_1_4[8] = {
|
||||
Q31(0.00000000), Q31(-0.20791170), Q31(-0.40673664), Q31(-0.58778524),
|
||||
Q31(0.67369562), Q31( 0.52643216), Q31( 0.36124167), Q31( 0.18374951),
|
||||
Q31(0.00000000f), Q31(-0.20791170f), Q31(-0.40673664f), Q31(-0.58778524f),
|
||||
Q31(0.67369562f), Q31( 0.52643216f), Q31( 0.36124167f), Q31( 0.18374951f),
|
||||
};
|
||||
|
||||
static const INTFLOAT tns_tmp2_map_0_4[16] = {
|
||||
Q31( 0.00000000), Q31(-0.20791170), Q31(-0.40673664), Q31(-0.58778524),
|
||||
Q31(-0.74314481), Q31(-0.86602539), Q31(-0.95105654), Q31(-0.99452192),
|
||||
Q31( 0.99573416), Q31( 0.96182561), Q31( 0.89516330), Q31( 0.79801720),
|
||||
Q31( 0.67369562), Q31( 0.52643216), Q31( 0.36124167), Q31( 0.18374951),
|
||||
Q31( 0.00000000f), Q31(-0.20791170f), Q31(-0.40673664f), Q31(-0.58778524f),
|
||||
Q31(-0.74314481f), Q31(-0.86602539f), Q31(-0.95105654f), Q31(-0.99452192f),
|
||||
Q31( 0.99573416f), Q31( 0.96182561f), Q31( 0.89516330f), Q31( 0.79801720f),
|
||||
Q31( 0.67369562f), Q31( 0.52643216f), Q31( 0.36124167f), Q31( 0.18374951f),
|
||||
};
|
||||
|
||||
static const INTFLOAT * const tns_tmp2_map[4] = {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# subsystems
|
||||
OBJS-$(CONFIG_DCA_DECODER) += aarch64/synth_filter_init.o
|
||||
OBJS-$(CONFIG_FFT) += aarch64/fft_init_aarch64.o
|
||||
OBJS-$(CONFIG_FMTCONVERT) += aarch64/fmtconvert_init.o
|
||||
OBJS-$(CONFIG_H264CHROMA) += aarch64/h264chroma_init_aarch64.o
|
||||
@@ -11,20 +11,13 @@ OBJS-$(CONFIG_MPEGAUDIODSP) += aarch64/mpegaudiodsp_init.o
|
||||
OBJS-$(CONFIG_NEON_CLOBBER_TEST) += aarch64/neontest.o
|
||||
OBJS-$(CONFIG_VIDEODSP) += aarch64/videodsp_init.o
|
||||
|
||||
# decoders/encoders
|
||||
OBJS-$(CONFIG_DCA_DECODER) += aarch64/synth_filter_init.o
|
||||
OBJS-$(CONFIG_RV40_DECODER) += aarch64/rv40dsp_init_aarch64.o
|
||||
OBJS-$(CONFIG_VC1DSP) += aarch64/vc1dsp_init_aarch64.o
|
||||
OBJS-$(CONFIG_VC1_DECODER) += aarch64/vc1dsp_init_aarch64.o
|
||||
OBJS-$(CONFIG_VORBIS_DECODER) += aarch64/vorbisdsp_init.o
|
||||
|
||||
# ARMv8 optimizations
|
||||
|
||||
# subsystems
|
||||
ARMV8-OBJS-$(CONFIG_VIDEODSP) += aarch64/videodsp.o
|
||||
|
||||
# NEON optimizations
|
||||
|
||||
# subsystems
|
||||
NEON-OBJS-$(CONFIG_DCA_DECODER) += aarch64/synth_filter_neon.o
|
||||
NEON-OBJS-$(CONFIG_FFT) += aarch64/fft_neon.o
|
||||
NEON-OBJS-$(CONFIG_FMTCONVERT) += aarch64/fmtconvert_neon.o
|
||||
NEON-OBJS-$(CONFIG_H264CHROMA) += aarch64/h264cmc_neon.o
|
||||
@@ -35,9 +28,7 @@ NEON-OBJS-$(CONFIG_H264QPEL) += aarch64/h264qpel_neon.o \
|
||||
aarch64/hpeldsp_neon.o
|
||||
NEON-OBJS-$(CONFIG_HPELDSP) += aarch64/hpeldsp_neon.o
|
||||
NEON-OBJS-$(CONFIG_IMDCT15) += aarch64/imdct15_neon.o
|
||||
NEON-OBJS-$(CONFIG_MDCT) += aarch64/mdct_neon.o
|
||||
NEON-OBJS-$(CONFIG_MPEGAUDIODSP) += aarch64/mpegaudiodsp_neon.o
|
||||
NEON-OBJS-$(CONFIG_MDCT) += aarch64/mdct_neon.o
|
||||
|
||||
# decoders/encoders
|
||||
NEON-OBJS-$(CONFIG_DCA_DECODER) += aarch64/synth_filter_neon.o
|
||||
NEON-OBJS-$(CONFIG_VORBIS_DECODER) += aarch64/vorbisdsp_neon.o
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user