Compare commits
169 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
f682094aaa | ||
![]() |
f9c9ee445f | ||
![]() |
8935e7474a | ||
![]() |
4ad5618210 | ||
![]() |
6b4c38b362 | ||
![]() |
049b08d04c | ||
![]() |
8454d81ebe | ||
![]() |
6f0e349a02 | ||
![]() |
56173eabb6 | ||
![]() |
d80db23e7d | ||
![]() |
c4cc8584d0 | ||
![]() |
1c1af2af0d | ||
![]() |
d4653e882f | ||
![]() |
8f17d7dd4b | ||
![]() |
dd8228dcff | ||
![]() |
c0cbf3af01 | ||
![]() |
b0283ccb9e | ||
![]() |
97f23c72a3 | ||
![]() |
3b0b8c6531 | ||
![]() |
1f625431e2 | ||
![]() |
4a94678f1b | ||
![]() |
c624935554 | ||
![]() |
06df542067 | ||
![]() |
82a11fcff2 | ||
![]() |
cee1568ae1 | ||
![]() |
870e74dc43 | ||
![]() |
1218f8ed49 | ||
![]() |
c409ac5adc | ||
![]() |
575cbbffaa | ||
![]() |
680880c98d | ||
![]() |
d75909f247 | ||
![]() |
ccdc68eb35 | ||
![]() |
ef0c89e969 | ||
![]() |
8413f12e1b | ||
![]() |
df825c956a | ||
![]() |
d61b38b9db | ||
![]() |
d912a30c7d | ||
![]() |
8dba5608dc | ||
![]() |
7ce728050b | ||
![]() |
851098c9e0 | ||
![]() |
bba709214a | ||
![]() |
0eca0da06e | ||
![]() |
0125c10217 | ||
![]() |
d38580a7bb | ||
![]() |
8acf9905a1 | ||
![]() |
ba5bb0562b | ||
![]() |
1550c0885d | ||
![]() |
38a511e84c | ||
![]() |
ba4b08b789 | ||
![]() |
67a7ed623b | ||
![]() |
c76505e0de | ||
![]() |
30c08e2261 | ||
![]() |
7367cbec1b | ||
![]() |
28acce2861 | ||
![]() |
7347205351 | ||
![]() |
0d93d5c461 | ||
![]() |
a31ccacb1a | ||
![]() |
494cfacdb9 | ||
![]() |
4f58d8ebc1 | ||
![]() |
47b5fabd6a | ||
![]() |
e66860a66b | ||
![]() |
4e9b2c5732 | ||
![]() |
a12dec4699 | ||
![]() |
661ee45f88 | ||
![]() |
fa5292d9d4 | ||
![]() |
a6a61a6d1d | ||
![]() |
b8fc301769 | ||
![]() |
9b667da05d | ||
![]() |
4007352bd0 | ||
![]() |
5c6a2d9878 | ||
![]() |
17c54e9317 | ||
![]() |
14d4eee547 | ||
![]() |
07624cfeaa | ||
![]() |
d6f763659c | ||
![]() |
e297459eb6 | ||
![]() |
afe2726089 | ||
![]() |
23f0d0f16b | ||
![]() |
47953c33ea | ||
![]() |
64a854d06b | ||
![]() |
91805f06a3 | ||
![]() |
8120a1d9bd | ||
![]() |
211a107208 | ||
![]() |
fdd09e5d7b | ||
![]() |
00d35e82b2 | ||
![]() |
807342e1cf | ||
![]() |
abaf8c386e | ||
![]() |
e5578ad3cd | ||
![]() |
4e0fae982e | ||
![]() |
f62fa1ce9f | ||
![]() |
8a63deab15 | ||
![]() |
87ae12009e | ||
![]() |
fe06305b0d | ||
![]() |
3970d4e728 | ||
![]() |
80a173a33b | ||
![]() |
d58c5586ec | ||
![]() |
0411b19289 | ||
![]() |
fd30240e98 | ||
![]() |
d484a07f1c | ||
![]() |
54e4bf3296 | ||
![]() |
8045254bac | ||
![]() |
3e17543491 | ||
![]() |
7275dc28f6 | ||
![]() |
638e183d11 | ||
![]() |
57f51e843e | ||
![]() |
b38b6b2798 | ||
![]() |
7fc85451fd | ||
![]() |
42c8fdb943 | ||
![]() |
1450d6e637 | ||
![]() |
a99a35c8ea | ||
![]() |
a582b028a4 | ||
![]() |
5d833dd299 | ||
![]() |
01f1201267 | ||
![]() |
f4e34d1614 | ||
![]() |
61f55565fb | ||
![]() |
b6b46db9e4 | ||
![]() |
21d99be9dc | ||
![]() |
7b6b9be861 | ||
![]() |
374409eb1a | ||
![]() |
a352fedb24 | ||
![]() |
c92068430d | ||
![]() |
274a5b7cdb | ||
![]() |
95345e942c | ||
![]() |
87757508ab | ||
![]() |
f66418afba | ||
![]() |
7371b0ca6f | ||
![]() |
c5cbda5079 | ||
![]() |
8893f7d815 | ||
![]() |
7c772ccd27 | ||
![]() |
cf82c5cd5b | ||
![]() |
cb8577a4da | ||
![]() |
b55b34f862 | ||
![]() |
609d299ed0 | ||
![]() |
01a0612c70 | ||
![]() |
dcf1830a15 | ||
![]() |
0a48a67e57 | ||
![]() |
72ac64544f | ||
![]() |
b62c0c0bce | ||
![]() |
00498a7e59 | ||
![]() |
06107e9605 | ||
![]() |
ce993ce791 | ||
![]() |
c0b90d4088 | ||
![]() |
b7b61ff6a3 | ||
![]() |
7a6e47b99d | ||
![]() |
f84c349b3b | ||
![]() |
26f732e21d | ||
![]() |
82b2dd5ee4 | ||
![]() |
e82ddde05a | ||
![]() |
07f5da6128 | ||
![]() |
e845455225 | ||
![]() |
3fedb3e65c | ||
![]() |
1986380df2 | ||
![]() |
df3850db49 | ||
![]() |
082b4f8348 | ||
![]() |
788c313b50 | ||
![]() |
779d7610c7 | ||
![]() |
56629aa012 | ||
![]() |
33651e3edf | ||
![]() |
d46aada5c2 | ||
![]() |
66b1f210c0 | ||
![]() |
d4b98d475f | ||
![]() |
8d8962ca3e | ||
![]() |
329559ae50 | ||
![]() |
0b3a88fe15 | ||
![]() |
563fe360c3 | ||
![]() |
73a502dd43 | ||
![]() |
ea189b77eb | ||
![]() |
2ebd47841f | ||
![]() |
9d7244c4c6 | ||
![]() |
7aee089978 |
769
Changelog
Normal file
769
Changelog
Normal file
@@ -0,0 +1,769 @@
|
||||
Entries are sorted chronologically from oldest to youngest within each release,
|
||||
releases are sorted from youngest to oldest.
|
||||
|
||||
version 0.7.4:
|
||||
|
||||
- vorbis: An additional defense in the Vorbis codec. (CVE-2011-3895)
|
||||
- vorbisdec: Fix decoding bug with channel handling.
|
||||
- matroskadec: Fix a bug where a pointer was cached to an array that might
|
||||
later move due to a realloc(). (CVE-2011-3893)
|
||||
- vorbis: Avoid some out-of-bounds reads. (CVE-2011-3893)
|
||||
- vp3: fix oob read for negative tokens and memleaks on error, (CVE-2011-3892)
|
||||
- avserver: Fix a bug where the socket is IPv4, but IPv6 is autoselected
|
||||
for the loopback address.
|
||||
- vp3: fix streams with non-zero last coefficient.
|
||||
- swscale: fix crash in fast_bilinear code when compiled with -mred-zone.
|
||||
|
||||
|
||||
version 0.7.3:
|
||||
|
||||
- check buffer and input values in various parts of the code:
|
||||
vmd (CVE-2011-4364), qdm2 (CVE-2011-4351), imgutils (several codecs),
|
||||
vp6 (CVE-2011-4353), svq1 (CVE-2011-4579), vp3 (CVE-2011-4352), wma, 4xm
|
||||
- backport avcodec_open2() as a replacement for avcodec_open()
|
||||
- backport avformat_find_stream_info()
|
||||
|
||||
|
||||
version 0.7.2:
|
||||
|
||||
- check buffer and input values in various parts of the code:
|
||||
H.264, VC-1, APE, FLV, Indeo 2, XAN, Ogg, MXF, wavpack, ffv1, MOV,
|
||||
cavs (OCERT-2011-002, CVE-2011-3362), Smacker, cpu detection, lavf,
|
||||
Matroska (CVE-2011-3504), RV10, RV30/RV40
|
||||
- memory leaks: vf_scale, eval
|
||||
|
||||
- ARM: workaround for bug in GNU assembler
|
||||
- AVOptions: fix av_set_string3() doxy to match reality. (Bug #28)
|
||||
- Reintroduce AVInputStream.nb_streams to avoid crashes
|
||||
- aac: Only output configure if audio was found
|
||||
- aac: Remove some suspicious illegal memcpy()s from LTP
|
||||
- aacps: skip some memcpy() if src and dst would be equal
|
||||
- adts: fix PCE copying
|
||||
- alsa: fallback to buffer_size/4 for period_size
|
||||
- alsa: limit buffer_size to 32768 frames
|
||||
- cljr, indeo2: init_get_bits size in bits instead of bytes
|
||||
- configure: add missing CFLAGS to fix building on the HURD
|
||||
- dca: set AVCodecContext frame_size for DTS audio
|
||||
- fate: allow testing with libavfilter disabled
|
||||
- gxf: fix 25 fps DV material in GXF being misdetected as 50 fps
|
||||
- h264: correct implicit weight table computation for long ref pics
|
||||
- h264: correct the check for invalid long term frame index in MMCO decode
|
||||
- h264: fix PCM intra-coded blocks in monochrome case
|
||||
- jpegdec: actually search for and parse RSTn
|
||||
- lavc: fix type for thread_type option
|
||||
- lavf: fix context pointer in av_open_input_stream when avformat_open_input fails
|
||||
- lavf: do not set codec_tag for rawvideo
|
||||
- libx264: do not set pic quality if no frame is output
|
||||
- movenc: create an alternate group for each media type
|
||||
- mpegts: fix Continuity Counter error detection
|
||||
- mxfenc: fix ignored drop flag in binary timecode representation
|
||||
- fix crashes in 32-bit PIC builds (cf e.g. http://bugs.debian.org/639948)
|
||||
- ppc64: fix cast related random failures
|
||||
- riff: Add mpgv MPEG-2 fourcc
|
||||
- swscale: don't use planar output functions to write to NV12/21
|
||||
- vc1: properly zero coded_block[] edges on new slice entry
|
||||
- vp3/theora: flush after seek
|
||||
|
||||
- various bug other fixes
|
||||
|
||||
|
||||
version 0.7.1:
|
||||
|
||||
- added various additional FOURCC codec identifiers
|
||||
- H.264 4:4:4 fixes
|
||||
- build system and compilation fixes
|
||||
- Doxygen and general documentation corrections and improvements
|
||||
- fixed segfault in ffprobe
|
||||
- behavioral fix in av_open_input_stream()
|
||||
- Licensing clarification for LGPL'ed vf_gradfun
|
||||
- bugfixes while seeking in multithreaded decoding
|
||||
- support newer versions of OpenCV
|
||||
- ffmpeg: fix operation with --disable-avfilter
|
||||
- fixed integer underflow in matroska decoder
|
||||
|
||||
|
||||
version 0.7:
|
||||
|
||||
- E-AC-3 audio encoder
|
||||
- ac3enc: add channel coupling support
|
||||
- floating-point sample format support for (E-)AC-3, DCA, AAC, Vorbis decoders
|
||||
- H.264/MPEG frame-level multithreading
|
||||
- av_metadata_* functions renamed to av_dict_* and moved to libavutil
|
||||
- 4:4:4 H.264 decoding support
|
||||
- 10-bit H.264 optimizations for x86
|
||||
- bump libswscale for recently reported ABI break
|
||||
|
||||
|
||||
version 0.7_beta2:
|
||||
|
||||
- VP8 frame-level multithreading
|
||||
- NEON optimizations for VP8
|
||||
- removed a lot of deprecated API cruft
|
||||
- FFT and IMDCT optimizations for AVX (Sandy Bridge) processors
|
||||
- DPX image encoder
|
||||
- SMPTE 302M AES3 audio decoder
|
||||
- ffmpeg no longer quits after the 'q' key is pressed; use 'ctrl+c' instead
|
||||
- 9bit and 10bit per sample support in the H.264 decoder
|
||||
|
||||
|
||||
version 0.7_beta1:
|
||||
|
||||
- WebM support in Matroska de/muxer
|
||||
- low overhead Ogg muxing
|
||||
- MMS-TCP support
|
||||
- VP8 de/encoding via libvpx
|
||||
- Demuxer for On2's IVF format
|
||||
- Pictor/PC Paint decoder
|
||||
- HE-AAC v2 decoder
|
||||
- libfaad2 wrapper removed
|
||||
- DTS-ES extension (XCh) decoding support
|
||||
- native VP8 decoder
|
||||
- RTSP tunneling over HTTP
|
||||
- RTP depacketization of SVQ3
|
||||
- -strict inofficial replaced by -strict unofficial
|
||||
- ffplay -exitonkeydown and -exitonmousedown options added
|
||||
- native GSM / GSM MS decoder
|
||||
- RTP depacketization of QDM2
|
||||
- ANSI/ASCII art playback system
|
||||
- Lego Mindstorms RSO de/muxer
|
||||
- SubRip subtitle file muxer and demuxer
|
||||
- Chinese AVS encoding via libxavs
|
||||
- ffprobe -show_packets option added
|
||||
- RTP packetization of Theora and Vorbis
|
||||
- RTP depacketization of MP4A-LATM
|
||||
- RTP packetization and depacketization of VP8
|
||||
- hflip filter
|
||||
- Apple HTTP Live Streaming demuxer
|
||||
- a64 codec
|
||||
- MMS-HTTP support
|
||||
- G.722 ADPCM audio encoder/decoder
|
||||
- R10k video decoder
|
||||
- ocv_smooth filter
|
||||
- frei0r wrapper filter
|
||||
- change crop filter syntax to width:height:x:y
|
||||
- make the crop filter accept parametric expressions
|
||||
- make ffprobe accept AVFormatContext options
|
||||
- yadif filter
|
||||
- blackframe filter
|
||||
- Demuxer for Leitch/Harris' VR native stream format (LXF)
|
||||
- RTP depacketization of the X-QT QuickTime format
|
||||
- SAP (Session Announcement Protocol, RFC 2974) muxer and demuxer
|
||||
- cropdetect filter
|
||||
- ffmpeg -crop* options removed
|
||||
- transpose filter added
|
||||
- ffmpeg -force_key_frames option added
|
||||
- demuxer for receiving raw rtp:// URLs without an SDP description
|
||||
- single stream LATM/LOAS decoder
|
||||
- setpts filter added
|
||||
- Win64 support for optimized x86 assembly functions
|
||||
- MJPEG/AVI1 to JPEG/JFIF bitstream filter
|
||||
- ASS subtitle encoder and decoder
|
||||
- IEC 61937 encapsulation for E-AC-3, TrueHD, DTS-HD (for HDMI passthrough)
|
||||
- overlay filter added
|
||||
- rename aspect filter to setdar, and pixelaspect to setsar
|
||||
- IEC 61937 demuxer
|
||||
- Mobotix .mxg demuxer
|
||||
- frei0r source added
|
||||
- hqdn3d filter added
|
||||
- RTP depacketization of QCELP
|
||||
- FLAC parser added
|
||||
- gradfun filter added
|
||||
- AMR-WB decoder
|
||||
- replace the ocv_smooth filter with a more generic ocv filter
|
||||
- Windows Televison (WTV) demuxer
|
||||
- FFmpeg metadata format muxer and demuxer
|
||||
- SubRip (srt) subtitle decoder
|
||||
- floating-point AC-3 encoder added
|
||||
- Lagarith decoder
|
||||
- ffmpeg -copytb option added
|
||||
- IVF muxer added
|
||||
- Wing Commander IV movies decoder added
|
||||
- movie source added
|
||||
- Bink version 'b' audio and video decoder
|
||||
- Bitmap Brothers JV playback system
|
||||
- Apple HTTP Live Streaming protocol handler
|
||||
- sndio support for playback and record
|
||||
- Linux framebuffer input device added
|
||||
- Chronomaster DFA decoder
|
||||
- Mobotix MxPEG decoder
|
||||
- AAC encoding via libvo-aacenc
|
||||
- AMR-WB encoding via libvo-amrwbenc
|
||||
- xWMA demuxer
|
||||
- fieldorder video filter added
|
||||
|
||||
|
||||
version 0.6:
|
||||
|
||||
- PB-frame decoding for H.263
|
||||
- deprecated vhook subsystem removed
|
||||
- deprecated old scaler removed
|
||||
- VQF demuxer
|
||||
- Alpha channel scaler
|
||||
- PCX encoder
|
||||
- RTP packetization of H.263
|
||||
- RTP packetization of AMR
|
||||
- RTP depacketization of Vorbis
|
||||
- CorePNG decoding support
|
||||
- Cook multichannel decoding support
|
||||
- introduced avlanguage helpers in libavformat
|
||||
- 8088flex TMV demuxer and decoder
|
||||
- per-stream language-tags extraction in asfdec
|
||||
- V210 decoder and encoder
|
||||
- remaining GPL parts in AC-3 decoder converted to LGPL
|
||||
- QCP demuxer
|
||||
- SoX native format muxer and demuxer
|
||||
- AMR-NB decoding/encoding, AMR-WB decoding via OpenCORE libraries
|
||||
- DPX image decoder
|
||||
- Electronic Arts Madcow decoder
|
||||
- DivX (XSUB) subtitle encoder
|
||||
- nonfree libamr support for AMR-NB/WB decoding/encoding removed
|
||||
- experimental AAC encoder
|
||||
- RTP depacketization of ASF and RTSP from WMS servers
|
||||
- RTMP support in libavformat
|
||||
- noX handling for OPT_BOOL X options
|
||||
- Wave64 demuxer
|
||||
- IEC-61937 compatible Muxer
|
||||
- TwinVQ decoder
|
||||
- Bluray (PGS) subtitle decoder
|
||||
- LPCM support in MPEG-TS (HDMV RID as found on Blu-ray disks)
|
||||
- WMA Pro decoder
|
||||
- Core Audio Format demuxer
|
||||
- Atrac1 decoder
|
||||
- MD STUDIO audio demuxer
|
||||
- RF64 support in WAV demuxer
|
||||
- MPEG-4 Audio Lossless Coding (ALS) decoder
|
||||
- -formats option split into -formats, -codecs, -bsfs, and -protocols
|
||||
- IV8 demuxer
|
||||
- CDG demuxer and decoder
|
||||
- R210 decoder
|
||||
- Auravision Aura 1 and 2 decoders
|
||||
- Deluxe Paint Animation playback system
|
||||
- SIPR decoder
|
||||
- Adobe Filmstrip muxer and demuxer
|
||||
- RTP depacketization of H.263
|
||||
- Bink demuxer and audio/video decoders
|
||||
- enable symbol versioning by default for linkers that support it
|
||||
- IFF PBM/ILBM bitmap decoder
|
||||
- concat protocol
|
||||
- Indeo 5 decoder
|
||||
- RTP depacketization of AMR
|
||||
- WMA Voice decoder
|
||||
- ffprobe tool
|
||||
- AMR-NB decoder
|
||||
- RTSP muxer
|
||||
- HE-AAC v1 decoder
|
||||
- Kega Game Video (KGV1) decoder
|
||||
- VorbisComment writing for FLAC, Ogg FLAC and Ogg Speex files
|
||||
- RTP depacketization of Theora
|
||||
- HTTP Digest authentication
|
||||
- RTMP/RTMPT/RTMPS/RTMPE/RTMPTE protocol support via librtmp
|
||||
- Psygnosis YOP demuxer and video decoder
|
||||
- spectral extension support in the E-AC-3 decoder
|
||||
- unsharp video filter
|
||||
- RTP hinting in the mov/3gp/mp4 muxer
|
||||
- Dirac in Ogg demuxing
|
||||
- seek to keyframes in Ogg
|
||||
- 4:2:2 and 4:4:4 Theora decoding
|
||||
- 35% faster VP3/Theora decoding
|
||||
- faster AAC decoding
|
||||
- faster H.264 decoding
|
||||
- RealAudio 1.0 (14.4K) encoder
|
||||
|
||||
|
||||
version 0.5:
|
||||
|
||||
- DV50 AKA DVCPRO50 encoder, decoder, muxer and demuxer
|
||||
- TechSmith Camtasia (TSCC) video decoder
|
||||
- IBM Ultimotion (ULTI) video decoder
|
||||
- Sierra Online audio file demuxer and decoder
|
||||
- Apple QuickDraw (qdrw) video decoder
|
||||
- Creative ADPCM audio decoder (16 bits as well as 8 bits schemes)
|
||||
- Electronic Arts Multimedia (WVE/UV2/etc.) file demuxer
|
||||
- Miro VideoXL (VIXL) video decoder
|
||||
- H.261 video encoder
|
||||
- QPEG video decoder
|
||||
- Nullsoft Video (NSV) file demuxer
|
||||
- Shorten audio decoder
|
||||
- LOCO video decoder
|
||||
- Apple Lossless Audio Codec (ALAC) decoder
|
||||
- Winnov WNV1 video decoder
|
||||
- Autodesk Animator Studio Codec (AASC) decoder
|
||||
- Indeo 2 video decoder
|
||||
- Fraps FPS1 video decoder
|
||||
- Snow video encoder/decoder
|
||||
- Sonic audio encoder/decoder
|
||||
- Vorbis audio decoder
|
||||
- Macromedia ADPCM decoder
|
||||
- Duck TrueMotion 2 video decoder
|
||||
- support for decoding FLX and DTA extensions in FLIC files
|
||||
- H.264 custom quantization matrices support
|
||||
- ffserver fixed, it should now be usable again
|
||||
- QDM2 audio decoder
|
||||
- Real Cooker audio decoder
|
||||
- TrueSpeech audio decoder
|
||||
- WMA2 audio decoder fixed, now all files should play correctly
|
||||
- RealAudio 14.4 and 28.8 decoders fixed
|
||||
- JPEG-LS decoder
|
||||
- build system improvements
|
||||
- tabs and trailing whitespace removed from the codebase
|
||||
- CamStudio video decoder
|
||||
- AIFF/AIFF-C audio format, encoding and decoding
|
||||
- ADTS AAC file reading and writing
|
||||
- Creative VOC file reading and writing
|
||||
- American Laser Games multimedia (*.mm) playback system
|
||||
- Zip Motion Blocks Video decoder
|
||||
- improved Theora/VP3 decoder
|
||||
- True Audio (TTA) decoder
|
||||
- AVS demuxer and video decoder
|
||||
- JPEG-LS encoder
|
||||
- Smacker demuxer and decoder
|
||||
- NuppelVideo/MythTV demuxer and RTjpeg decoder
|
||||
- KMVC decoder
|
||||
- MPEG-2 intra VLC support
|
||||
- MPEG-2 4:2:2 encoder
|
||||
- Flash Screen Video decoder
|
||||
- GXF demuxer
|
||||
- Chinese AVS decoder
|
||||
- GXF muxer
|
||||
- MXF demuxer
|
||||
- VC-1/WMV3/WMV9 video decoder
|
||||
- MacIntel support
|
||||
- AVISynth support
|
||||
- VMware video decoder
|
||||
- VP5 video decoder
|
||||
- VP6 video decoder
|
||||
- WavPack lossless audio decoder
|
||||
- Targa (.TGA) picture decoder
|
||||
- Vorbis audio encoder
|
||||
- Delphine Software .cin demuxer/audio and video decoder
|
||||
- Tiertex .seq demuxer/video decoder
|
||||
- MTV demuxer
|
||||
- TIFF picture encoder and decoder
|
||||
- GIF picture decoder
|
||||
- Intel Music Coder decoder
|
||||
- Zip Motion Blocks Video encoder
|
||||
- Musepack decoder
|
||||
- Flash Screen Video encoder
|
||||
- Theora encoding via libtheora
|
||||
- BMP encoder
|
||||
- WMA encoder
|
||||
- GSM-MS encoder and decoder
|
||||
- DCA decoder
|
||||
- DXA demuxer and decoder
|
||||
- DNxHD decoder
|
||||
- Gamecube movie (.THP) playback system
|
||||
- Blackfin optimizations
|
||||
- Interplay C93 demuxer and video decoder
|
||||
- Bethsoft VID demuxer and video decoder
|
||||
- CRYO APC demuxer
|
||||
- Atrac3 decoder
|
||||
- V.Flash PTX decoder
|
||||
- RoQ muxer, RoQ audio encoder
|
||||
- Renderware TXD demuxer and decoder
|
||||
- extern C declarations for C++ removed from headers
|
||||
- sws_flags command line option
|
||||
- codebook generator
|
||||
- RoQ video encoder
|
||||
- QTRLE encoder
|
||||
- OS/2 support removed and restored again
|
||||
- AC-3 decoder
|
||||
- NUT muxer
|
||||
- additional SPARC (VIS) optimizations
|
||||
- Matroska muxer
|
||||
- slice-based parallel H.264 decoding
|
||||
- Monkey's Audio demuxer and decoder
|
||||
- AMV audio and video decoder
|
||||
- DNxHD encoder
|
||||
- H.264 PAFF decoding
|
||||
- Nellymoser ASAO decoder
|
||||
- Beam Software SIFF demuxer and decoder
|
||||
- libvorbis Vorbis decoding removed in favor of native decoder
|
||||
- IntraX8 (J-Frame) subdecoder for WMV2 and VC-1
|
||||
- Ogg (Theora, Vorbis and FLAC) muxer
|
||||
- The "device" muxers and demuxers are now in a new libavdevice library
|
||||
- PC Paintbrush PCX decoder
|
||||
- Sun Rasterfile decoder
|
||||
- TechnoTrend PVA demuxer
|
||||
- Linux Media Labs MPEG-4 (LMLM4) demuxer
|
||||
- AVM2 (Flash 9) SWF muxer
|
||||
- QT variant of IMA ADPCM encoder
|
||||
- VFW grabber
|
||||
- iPod/iPhone compatible mp4 muxer
|
||||
- Mimic decoder
|
||||
- MSN TCP Webcam stream demuxer
|
||||
- RL2 demuxer / decoder
|
||||
- IFF demuxer
|
||||
- 8SVX audio decoder
|
||||
- non-recursive Makefiles
|
||||
- BFI demuxer
|
||||
- MAXIS EA XA (.xa) demuxer / decoder
|
||||
- BFI video decoder
|
||||
- OMA demuxer
|
||||
- MLP/TrueHD decoder
|
||||
- Electronic Arts CMV decoder
|
||||
- Motion Pixels Video decoder
|
||||
- Motion Pixels MVI demuxer
|
||||
- removed animated GIF decoder/demuxer
|
||||
- D-Cinema audio muxer
|
||||
- Electronic Arts TGV decoder
|
||||
- Apple Lossless Audio Codec (ALAC) encoder
|
||||
- AAC decoder
|
||||
- floating point PCM encoder/decoder
|
||||
- MXF muxer
|
||||
- DV100 AKA DVCPRO HD decoder and demuxer
|
||||
- E-AC-3 support added to AC-3 decoder
|
||||
- Nellymoser ASAO encoder
|
||||
- ASS and SSA demuxer and muxer
|
||||
- liba52 wrapper removed
|
||||
- SVQ3 watermark decoding support
|
||||
- Speex decoding via libspeex
|
||||
- Electronic Arts TGQ decoder
|
||||
- RV40 decoder
|
||||
- QCELP / PureVoice decoder
|
||||
- RV30 decoder
|
||||
- hybrid WavPack support
|
||||
- R3D REDCODE demuxer
|
||||
- ALSA support for playback and record
|
||||
- Electronic Arts TQI decoder
|
||||
- OpenJPEG based JPEG 2000 decoder
|
||||
- NC (NC4600) camera file demuxer
|
||||
- Gopher client support
|
||||
- MXF D-10 muxer
|
||||
- generic metadata API
|
||||
|
||||
|
||||
version 0.4.9-pre1:
|
||||
|
||||
- DV encoder, DV muxer
|
||||
- Microsoft RLE video decoder
|
||||
- Microsoft Video-1 decoder
|
||||
- Apple Animation (RLE) decoder
|
||||
- Apple Graphics (SMC) decoder
|
||||
- Apple Video (RPZA) decoder
|
||||
- Cinepak decoder
|
||||
- Sega FILM (CPK) file demuxer
|
||||
- Westwood multimedia support (VQA & AUD files)
|
||||
- Id Quake II CIN playback support
|
||||
- 8BPS video decoder
|
||||
- FLIC playback support
|
||||
- RealVideo 2.0 (RV20) decoder
|
||||
- Duck TrueMotion v1 (DUCK) video decoder
|
||||
- Sierra VMD demuxer and video decoder
|
||||
- MSZH and ZLIB decoder support
|
||||
- SVQ1 video encoder
|
||||
- AMR-WB support
|
||||
- PPC optimizations
|
||||
- rate distortion optimal cbp support
|
||||
- rate distorted optimal ac prediction for MPEG-4
|
||||
- rate distorted optimal lambda->qp support
|
||||
- AAC encoding with libfaac
|
||||
- Sunplus JPEG codec (SP5X) support
|
||||
- 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
|
||||
- Add support for configuring with IBM XLC
|
||||
- floating point AAN DCT
|
||||
- initial support for zygo video (not complete)
|
||||
- RGB ffv1 support
|
||||
- new audio/video parser API
|
||||
- av_log() system
|
||||
- av_read_frame() and av_seek_frame() support
|
||||
- missing last frame fixes
|
||||
- seek by mouse in ffplay
|
||||
- noise reduction of DCT coefficients
|
||||
- H.263 OBMC & 4MV support
|
||||
- H.263 alternative inter vlc support
|
||||
- H.263 loop filter
|
||||
- H.263 slice structured mode
|
||||
- interlaced DCT support for MPEG-2 encoding
|
||||
- stuffing to stay above min_bitrate
|
||||
- MB type & QP visualization
|
||||
- frame stepping for ffplay
|
||||
- interlaced motion estimation
|
||||
- alternate scantable support
|
||||
- SVCD scan offset support
|
||||
- closed GOP support
|
||||
- SSE2 FDCT
|
||||
- quantizer noise shaping
|
||||
- G.726 ADPCM audio codec
|
||||
- MS ADPCM encoding
|
||||
- multithreaded/SMP motion estimation
|
||||
- multithreaded/SMP encoding for MPEG-1/MPEG-2/MPEG-4/H.263
|
||||
- multithreaded/SMP decoding for MPEG-2
|
||||
- FLAC decoder
|
||||
- Metrowerks CodeWarrior suppport
|
||||
- H.263+ custom pcf support
|
||||
- nicer output for 'ffmpeg -formats'
|
||||
- Matroska demuxer
|
||||
- SGI image format, encoding and decoding
|
||||
- H.264 loop filter support
|
||||
- H.264 CABAC support
|
||||
- nicer looking arrows for the motion vector visualization
|
||||
- improved VCD support
|
||||
- audio timestamp drift compensation
|
||||
- MPEG-2 YUV 422/444 support
|
||||
- polyphase kaiser windowed sinc and blackman nuttall windowed sinc audio resample
|
||||
- better image scaling
|
||||
- H.261 support
|
||||
- correctly interleave packets during encoding
|
||||
- VIS optimized motion compensation
|
||||
- intra_dc_precision>0 encoding support
|
||||
- support reuse of motion vectors/MB types/field select values of the source video
|
||||
- more accurate deblock filter
|
||||
- padding support
|
||||
- many optimizations and bugfixes
|
||||
- FunCom ISS audio file demuxer and according ADPCM decoding
|
||||
|
||||
|
||||
version 0.4.8:
|
||||
|
||||
- MPEG-2 video encoding (Michael)
|
||||
- Id RoQ playback subsystem (Mike Melanson and Tim Ferguson)
|
||||
- Wing Commander III Movie (.mve) file playback subsystem (Mike Melanson
|
||||
and Mario Brito)
|
||||
- Xan DPCM audio decoder (Mario Brito)
|
||||
- Interplay MVE playback subsystem (Mike Melanson)
|
||||
- Duck DK3 and DK4 ADPCM audio decoders (Mike Melanson)
|
||||
|
||||
|
||||
version 0.4.7:
|
||||
|
||||
- RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from mplayerhq
|
||||
(originally from public domain player for Amiga at http://www.honeypot.net/audio)
|
||||
- current version now also compiles with older GCC (Fabrice)
|
||||
- 4X multimedia playback system including 4xm file demuxer (Mike
|
||||
Melanson), and 4X video and audio codecs (Michael)
|
||||
- Creative YUV (CYUV) decoder (Mike Melanson)
|
||||
- FFV1 codec (our very simple lossless intra only codec, compresses much better
|
||||
than HuffYUV) (Michael)
|
||||
- ASV1 (Asus), H.264, Intel indeo3 codecs have been added (various)
|
||||
- tiny PNG encoder and decoder, tiny GIF decoder, PAM decoder (PPM with
|
||||
alpha support), JPEG YUV colorspace support. (Fabrice Bellard)
|
||||
- ffplay has been replaced with a newer version which uses SDL (optionally)
|
||||
for multiplatform support (Fabrice)
|
||||
- Sorenson Version 3 codec (SVQ3) support has been added (decoding only) - donated
|
||||
by anonymous
|
||||
- AMR format has been added (Johannes Carlsson)
|
||||
- 3GP support has been added (Johannes Carlsson)
|
||||
- VP3 codec has been added (Mike Melanson)
|
||||
- more MPEG-1/2 fixes
|
||||
- better multiplatform support, MS Visual Studio fixes (various)
|
||||
- AltiVec optimizations (Magnus Damn and others)
|
||||
- SH4 processor support has been added (BERO)
|
||||
- new public interfaces (avcodec_get_pix_fmt) (Roman Shaposhnick)
|
||||
- VOB streaming support (Brian Foley)
|
||||
- better MP3 autodetection (Andriy Rysin)
|
||||
- qpel encoding (Michael)
|
||||
- 4mv+b frames encoding finally fixed (Michael)
|
||||
- chroma ME (Michael)
|
||||
- 5 comparison functions for ME (Michael)
|
||||
- B-frame encoding speedup (Michael)
|
||||
- WMV2 codec (unfinished - Michael)
|
||||
- user specified diamond size for EPZS (Michael)
|
||||
- Playstation STR playback subsystem, still experimental (Mike and Michael)
|
||||
- ASV2 codec (Michael)
|
||||
- CLJR decoder (Alex)
|
||||
|
||||
.. And lots more new enhancements and fixes.
|
||||
|
||||
|
||||
version 0.4.6:
|
||||
|
||||
- completely new integer only MPEG audio layer 1/2/3 decoder rewritten
|
||||
from scratch
|
||||
- Recoded DCT and motion vector search with gcc (no longer depends on nasm)
|
||||
- fix quantization bug in AC3 encoder
|
||||
- added PCM codecs and format. Corrected WAV/AVI/ASF PCM issues
|
||||
- added prototype ffplay program
|
||||
- added GOB header parsing on H.263/H.263+ decoder (Juanjo)
|
||||
- bug fix on MCBPC tables of H.263 (Juanjo)
|
||||
- bug fix on DC coefficients of H.263 (Juanjo)
|
||||
- added Advanced Prediction Mode on H.263/H.263+ decoder (Juanjo)
|
||||
- now we can decode H.263 streams found in QuickTime files (Juanjo)
|
||||
- now we can decode H.263 streams found in VIVO v1 files(Juanjo)
|
||||
- preliminary RTP "friendly" mode for H.263/H.263+ coding. (Juanjo)
|
||||
- added GOB header for H.263/H.263+ coding on RTP mode (Juanjo)
|
||||
- now H.263 picture size is returned on the first decoded frame (Juanjo)
|
||||
- added first regression tests
|
||||
- added MPEG-2 TS demuxer
|
||||
- new demux API for libav
|
||||
- more accurate and faster IDCT (Michael)
|
||||
- faster and entropy-controlled motion search (Michael)
|
||||
- two pass video encoding (Michael)
|
||||
- new video rate control (Michael)
|
||||
- added MSMPEG4V1, MSMPEGV2 and WMV1 support (Michael)
|
||||
- great performance improvement of video encoders and decoders (Michael)
|
||||
- new and faster bit readers and vlc parsers (Michael)
|
||||
- high quality encoding mode: tries all macroblock/VLC types (Michael)
|
||||
- added DV video decoder
|
||||
- preliminary RTP/RTSP support in ffserver and libavformat
|
||||
- H.263+ AIC decoding/encoding support (Juanjo)
|
||||
- VCD MPEG-PS mode (Juanjo)
|
||||
- PSNR stuff (Juanjo)
|
||||
- simple stats output (Juanjo)
|
||||
- 16-bit and 15-bit RGB/BGR/GBR support (Bisqwit)
|
||||
|
||||
|
||||
version 0.4.5:
|
||||
|
||||
- some header fixes (Zdenek Kabelac <kabi at informatics.muni.cz>)
|
||||
- many MMX optimizations (Nick Kurshev <nickols_k at mail.ru>)
|
||||
- added configure system (actually a small shell script)
|
||||
- added MPEG audio layer 1/2/3 decoding using LGPL'ed mpglib by
|
||||
Michael Hipp (temporary solution - waiting for integer only
|
||||
decoder)
|
||||
- fixed VIDIOCSYNC interrupt
|
||||
- added Intel H.263 decoding support ('I263' AVI fourCC)
|
||||
- added Real Video 1.0 decoding (needs further testing)
|
||||
- simplified image formats again. Added PGM format (=grey
|
||||
pgm). Renamed old PGM to PGMYUV.
|
||||
- fixed msmpeg4 slice issues (tell me if you still find problems)
|
||||
- fixed OpenDivX bugs with newer versions (added VOL header decoding)
|
||||
- added support for MPlayer interface
|
||||
- added macroblock skip optimization
|
||||
- added MJPEG decoder
|
||||
- added mmx/mmxext IDCT from libmpeg2
|
||||
- added pgmyuvpipe, ppm, and ppm_pipe formats (original patch by Celer
|
||||
<celer at shell.scrypt.net>)
|
||||
- added pixel format conversion layer (e.g. for MJPEG or PPM)
|
||||
- added deinterlacing option
|
||||
- MPEG-1/2 fixes
|
||||
- MPEG-4 vol header fixes (Jonathan Marsden <snmjbm at pacbell.net>)
|
||||
- ARM optimizations (Lionel Ulmer <lionel.ulmer at free.fr>).
|
||||
- Windows porting of file converter
|
||||
- added MJPEG raw format (input/ouput)
|
||||
- added JPEG image format support (input/output)
|
||||
|
||||
|
||||
version 0.4.4:
|
||||
|
||||
- fixed some std header definitions (Bjorn Lindgren
|
||||
<bjorn.e.lindgren at telia.com>).
|
||||
- added MPEG demuxer (MPEG-1 and 2 compatible).
|
||||
- added ASF demuxer
|
||||
- added prototype RM demuxer
|
||||
- added AC3 decoding (done with libac3 by Aaron Holtzman)
|
||||
- added decoding codec parameter guessing (.e.g. for MPEG, because the
|
||||
header does not include them)
|
||||
- fixed header generation in MPEG-1, AVI and ASF muxer: wmplayer can now
|
||||
play them (only tested video)
|
||||
- fixed H.263 white bug
|
||||
- fixed phase rounding in img resample filter
|
||||
- add MMX code for polyphase img resample filter
|
||||
- added CPU autodetection
|
||||
- added generic title/author/copyright/comment string handling (ASF and RM
|
||||
use them)
|
||||
- added SWF demux to extract MP3 track (not usable yet because no MP3
|
||||
decoder)
|
||||
- added fractional frame rate support
|
||||
- codecs are no longer searched by read_header() (should fix ffserver
|
||||
segfault)
|
||||
|
||||
|
||||
version 0.4.3:
|
||||
|
||||
- BGR24 patch (initial patch by Jeroen Vreeken <pe1rxq at amsat.org>)
|
||||
- fixed raw yuv output
|
||||
- added motion rounding support in MPEG-4
|
||||
- fixed motion bug rounding in MSMPEG4
|
||||
- added B-frame handling in video core
|
||||
- added full MPEG-1 decoding support
|
||||
- added partial (frame only) MPEG-2 support
|
||||
- changed the FOURCC code for H.263 to "U263" to be able to see the
|
||||
+AVI/H.263 file with the UB Video H.263+ decoder. MPlayer works with
|
||||
this +codec ;) (JuanJo).
|
||||
- Halfpel motion estimation after MB type selection (JuanJo)
|
||||
- added pgm and .Y.U.V output format
|
||||
- suppressed 'img:' protocol. Simply use: /tmp/test%d.[pgm|Y] as input or
|
||||
output.
|
||||
- added pgmpipe I/O format (original patch from Martin Aumueller
|
||||
<lists at reserv.at>, but changed completely since we use a format
|
||||
instead of a protocol)
|
||||
|
||||
|
||||
version 0.4.2:
|
||||
|
||||
- added H.263/MPEG-4/MSMPEG4 decoding support. MPEG-4 decoding support
|
||||
(for OpenDivX) is almost complete: 8x8 MVs and rounding are
|
||||
missing. MSMPEG4 support is complete.
|
||||
- added prototype MPEG-1 decoder. Only I- and P-frames handled yet (it
|
||||
can decode ffmpeg MPEGs :-)).
|
||||
- added libavcodec API documentation (see apiexample.c).
|
||||
- fixed image polyphase bug (the bottom of some images could be
|
||||
greenish)
|
||||
- added support for non clipped motion vectors (decoding only)
|
||||
and image sizes non-multiple of 16
|
||||
- added support for AC prediction (decoding only)
|
||||
- added file overwrite confirmation (can be disabled with -y)
|
||||
- added custom size picture to H.263 using H.263+ (Juanjo)
|
||||
|
||||
|
||||
version 0.4.1:
|
||||
|
||||
- added MSMPEG4 (aka DivX) compatible encoder. Changed default codec
|
||||
of AVI and ASF to DIV3.
|
||||
- added -me option to set motion estimation method
|
||||
(default=log). suppressed redundant -hq option.
|
||||
- added options -acodec and -vcodec to force a given codec (useful for
|
||||
AVI for example)
|
||||
- fixed -an option
|
||||
- improved dct_quantize speed
|
||||
- factorized some motion estimation code
|
||||
|
||||
|
||||
version 0.4.0:
|
||||
|
||||
- removing grab code from ffserver and moved it to ffmpeg. Added
|
||||
multistream support to ffmpeg.
|
||||
- added timeshifting support for live feeds (option ?date=xxx in the
|
||||
URL)
|
||||
- added high quality image resize code with polyphase filter (need
|
||||
mmx/see optimization). Enable multiple image size support in ffserver.
|
||||
- added multi live feed support in ffserver
|
||||
- suppressed master feature from ffserver (it should be done with an
|
||||
external program which opens the .ffm url and writes it to another
|
||||
ffserver)
|
||||
- added preliminary support for video stream parsing (WAV and AVI half
|
||||
done). Added proper support for audio/video file conversion in
|
||||
ffmpeg.
|
||||
- added preliminary support for video file sending from ffserver
|
||||
- redesigning I/O subsystem: now using URL based input and output
|
||||
(see avio.h)
|
||||
- added WAV format support
|
||||
- added "tty user interface" to ffmpeg to stop grabbing gracefully
|
||||
- added MMX/SSE optimizations to SAD (Sums of Absolutes Differences)
|
||||
(Juan J. Sierralta P. a.k.a. "Juanjo" <juanjo at atmlab.utfsm.cl>)
|
||||
- added MMX DCT from mpeg2_movie 1.5 (Juanjo)
|
||||
- added new motion estimation algorithms, log and phods (Juanjo)
|
||||
- changed directories: libav for format handling, libavcodec for
|
||||
codecs
|
||||
|
||||
|
||||
version 0.3.4:
|
||||
|
||||
- added stereo in MPEG audio encoder
|
||||
|
||||
|
||||
version 0.3.3:
|
||||
|
||||
- added 'high quality' mode which use motion vectors. It can be used in
|
||||
real time at low resolution.
|
||||
- fixed rounding problems which caused quality problems at high
|
||||
bitrates and large GOP size
|
||||
|
||||
|
||||
version 0.3.2: small fixes
|
||||
|
||||
- ASF fixes
|
||||
- put_seek bug fix
|
||||
|
||||
|
||||
version 0.3.1: added avi/divx support
|
||||
|
||||
- added AVI support
|
||||
- added MPEG-4 codec compatible with OpenDivX. It is based on the H.263 codec
|
||||
- added sound for flash format (not tested)
|
||||
|
||||
|
||||
version 0.3: initial public release
|
2
Doxyfile
2
Doxyfile
@@ -31,7 +31,7 @@ PROJECT_NAME = FFmpeg
|
||||
# This could be handy for archiving the generated documentation or
|
||||
# if some version control system is used.
|
||||
|
||||
PROJECT_NUMBER = 0.8.6
|
||||
PROJECT_NUMBER = 0.7.11
|
||||
|
||||
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
|
||||
# base path where the generated documentation will be put.
|
||||
|
@@ -13,6 +13,7 @@ libavutil: 2011-04-18
|
||||
|
||||
API changes, most recent first:
|
||||
|
||||
|
||||
2011-06-19 - xxxxxxx - lavfi 2.23.0 - avfilter.h
|
||||
Add layout negotiation fields and helper functions.
|
||||
|
||||
@@ -43,6 +44,12 @@ API changes, most recent first:
|
||||
2011-06-12 - xxxxxxx - lavfi 2.16.0 - avfilter_graph_parse()
|
||||
Change avfilter_graph_parse() signature.
|
||||
|
||||
2011-07-10 - xxxxxxx - lavf 53.3.0
|
||||
Add avformat_find_stream_info(), deprecate av_find_stream_info().
|
||||
|
||||
2011-07-10 - xxxxxxx - lavc 53.6.0
|
||||
Add avcodec_open2(), deprecate avcodec_open().
|
||||
|
||||
2011-06-xx - xxxxxxx - lavf 53.2.0 - avformat.h
|
||||
Add avformat_open_input and avformat_write_header().
|
||||
Deprecate av_open_input_stream, av_open_input_file,
|
||||
|
@@ -2,7 +2,7 @@ Release Notes
|
||||
=============
|
||||
|
||||
* 0.8 "Love" June, 2011
|
||||
* 0.7 "Peace" June, 2011 (identical to 0.8 but using 0.6 ABI/API)
|
||||
* 0.7.1 "Peace" June, 2011 (identical to 0.8 but using 0.6 ABI/API)
|
||||
|
||||
|
||||
General notes
|
||||
|
@@ -479,7 +479,7 @@ int main(int argc, char **argv)
|
||||
|
||||
/* open the output file, if needed */
|
||||
if (!(fmt->flags & AVFMT_NOFILE)) {
|
||||
if (avio_open(&oc->pb, filename, AVIO_FLAG_WRITE) < 0) {
|
||||
if (avio_open(&oc->pb, filename, AVIO_WRONLY) < 0) {
|
||||
fprintf(stderr, "Could not open '%s'\n", filename);
|
||||
exit(1);
|
||||
}
|
||||
|
11
ffmpeg.c
11
ffmpeg.c
@@ -31,7 +31,7 @@
|
||||
#include "libavformat/avformat.h"
|
||||
#include "libavdevice/avdevice.h"
|
||||
#include "libswscale/swscale.h"
|
||||
#include "libavutil/opt.h"
|
||||
#include "libavcodec/opt.h"
|
||||
#include "libavcodec/audioconvert.h"
|
||||
#include "libavutil/audioconvert.h"
|
||||
#include "libavutil/parseutils.h"
|
||||
@@ -113,7 +113,9 @@ typedef struct AVChapterMap {
|
||||
static const OptionDef options[];
|
||||
|
||||
#define MAX_FILES 100
|
||||
#if !FF_API_MAX_STREAMS
|
||||
#define MAX_STREAMS 1024 /* arbitrary sanity check value */
|
||||
#endif
|
||||
|
||||
static const char *last_asked_format = NULL;
|
||||
static int64_t input_files_ts_offset[MAX_FILES];
|
||||
@@ -712,7 +714,6 @@ static int read_ffserver_streams(AVFormatContext *s, const char *filename)
|
||||
return err;
|
||||
/* copy stream format */
|
||||
s->nb_streams = 0;
|
||||
s->streams = av_mallocz(sizeof(AVStream *) * ic->nb_streams);
|
||||
for(i=0;i<ic->nb_streams;i++) {
|
||||
AVStream *st;
|
||||
AVCodec *codec;
|
||||
@@ -3957,7 +3958,7 @@ static int opt_output_file(const char *opt, const char *filename)
|
||||
/* check filename in case of an image number is expected */
|
||||
if (oc->oformat->flags & AVFMT_NEEDNUMBER) {
|
||||
if (!av_filename_number_test(oc->filename)) {
|
||||
print_error(oc->filename, AVERROR(EINVAL));
|
||||
print_error(oc->filename, AVERROR_NUMEXPECTED);
|
||||
ffmpeg_exit(1);
|
||||
}
|
||||
}
|
||||
@@ -3968,7 +3969,7 @@ static int opt_output_file(const char *opt, const char *filename)
|
||||
(strchr(filename, ':') == NULL ||
|
||||
filename[1] == ':' ||
|
||||
av_strstart(filename, "file:", NULL))) {
|
||||
if (avio_check(filename, 0) == 0) {
|
||||
if (url_exist(filename)) {
|
||||
if (!using_stdin) {
|
||||
fprintf(stderr,"File '%s' already exists. Overwrite ? [y/N] ", filename);
|
||||
fflush(stderr);
|
||||
@@ -3985,7 +3986,7 @@ static int opt_output_file(const char *opt, const char *filename)
|
||||
}
|
||||
|
||||
/* open the file */
|
||||
if ((err = avio_open(&oc->pb, filename, AVIO_FLAG_WRITE)) < 0) {
|
||||
if ((err = avio_open(&oc->pb, filename, AVIO_WRONLY)) < 0) {
|
||||
print_error(filename, err);
|
||||
ffmpeg_exit(1);
|
||||
}
|
||||
|
9
ffplay.c
9
ffplay.c
@@ -35,7 +35,7 @@
|
||||
#include "libavdevice/avdevice.h"
|
||||
#include "libswscale/swscale.h"
|
||||
#include "libavcodec/audioconvert.h"
|
||||
#include "libavutil/opt.h"
|
||||
#include "libavcodec/opt.h"
|
||||
#include "libavcodec/avfft.h"
|
||||
|
||||
#if CONFIG_AVFILTER
|
||||
@@ -2135,7 +2135,12 @@ static int stream_component_open(VideoState *is, int stream_index)
|
||||
|
||||
avctx->workaround_bugs = workaround_bugs;
|
||||
avctx->lowres = lowres;
|
||||
if(lowres) avctx->flags |= CODEC_FLAG_EMU_EDGE;
|
||||
if(avctx->lowres > codec->max_lowres){
|
||||
av_log(avctx, AV_LOG_WARNING, "The maximum value for lowres supported by the decoder is %d\n",
|
||||
codec->max_lowres);
|
||||
avctx->lowres= codec->max_lowres;
|
||||
}
|
||||
if(avctx->lowres) avctx->flags |= CODEC_FLAG_EMU_EDGE;
|
||||
avctx->idct_algo= idct;
|
||||
if(fast) avctx->flags2 |= CODEC_FLAG2_FAST;
|
||||
avctx->skip_frame= skip_frame;
|
||||
|
@@ -23,7 +23,7 @@
|
||||
|
||||
#include "libavformat/avformat.h"
|
||||
#include "libavcodec/avcodec.h"
|
||||
#include "libavutil/opt.h"
|
||||
#include "libavcodec/opt.h"
|
||||
#include "libavutil/pixdesc.h"
|
||||
#include "libavutil/dict.h"
|
||||
#include "libavdevice/avdevice.h"
|
||||
|
43
ffserver.c
43
ffserver.c
@@ -39,7 +39,7 @@
|
||||
#include "libavutil/dict.h"
|
||||
#include "libavutil/random_seed.h"
|
||||
#include "libavutil/parseutils.h"
|
||||
#include "libavutil/opt.h"
|
||||
#include "libavcodec/opt.h"
|
||||
#include <stdarg.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
@@ -94,7 +94,9 @@ static const char *http_state[] = {
|
||||
"RTSP_SEND_PACKET",
|
||||
};
|
||||
|
||||
#if !FF_API_MAX_STREAMS
|
||||
#define MAX_STREAMS 20
|
||||
#endif
|
||||
|
||||
#define IOBUFFER_INIT_SIZE 8192
|
||||
|
||||
@@ -516,6 +518,7 @@ static int socket_open_listen(struct sockaddr_in *my_addr)
|
||||
tmp = 1;
|
||||
setsockopt(server_fd, SOL_SOCKET, SO_REUSEADDR, &tmp, sizeof(tmp));
|
||||
|
||||
my_addr->sin_family = AF_INET;
|
||||
if (bind (server_fd, (struct sockaddr *) my_addr, sizeof (*my_addr)) < 0) {
|
||||
char bindmsg[32];
|
||||
snprintf(bindmsg, sizeof(bindmsg), "bind(port %d)", ntohs(my_addr->sin_port));
|
||||
@@ -2229,11 +2232,11 @@ static int http_prepare_data(HTTPContext *c)
|
||||
av_dict_set(&c->fmt_ctx.metadata, "copyright", c->stream->copyright, 0);
|
||||
av_dict_set(&c->fmt_ctx.metadata, "title" , c->stream->title , 0);
|
||||
|
||||
c->fmt_ctx.streams = av_mallocz(sizeof(AVStream *) * c->stream->nb_streams);
|
||||
|
||||
for(i=0;i<c->stream->nb_streams;i++) {
|
||||
AVStream *st;
|
||||
AVStream *src;
|
||||
c->fmt_ctx.streams[i] = av_mallocz(sizeof(AVStream));
|
||||
st = av_mallocz(sizeof(AVStream));
|
||||
c->fmt_ctx.streams[i] = st;
|
||||
/* if file or feed, then just take streams from FFStream struct */
|
||||
if (!c->stream->feed ||
|
||||
c->stream->feed == c->stream)
|
||||
@@ -2241,9 +2244,9 @@ static int http_prepare_data(HTTPContext *c)
|
||||
else
|
||||
src = c->stream->feed->streams[c->stream->feed_streams[i]];
|
||||
|
||||
*(c->fmt_ctx.streams[i]) = *src;
|
||||
c->fmt_ctx.streams[i]->priv_data = 0;
|
||||
c->fmt_ctx.streams[i]->codec->frame_number = 0; /* XXX: should be done in
|
||||
*st = *src;
|
||||
st->priv_data = 0;
|
||||
st->codec->frame_number = 0; /* XXX: should be done in
|
||||
AVStream, not in codec */
|
||||
}
|
||||
/* set output format parameters */
|
||||
@@ -2941,9 +2944,11 @@ static int prepare_sdp_description(FFStream *stream, uint8_t **pbuffer,
|
||||
snprintf(avc->filename, 1024, "rtp://0.0.0.0");
|
||||
}
|
||||
|
||||
#if !FF_API_MAX_STREAMS
|
||||
if (avc->nb_streams >= INT_MAX/sizeof(*avc->streams) ||
|
||||
!(avc->streams = av_malloc(avc->nb_streams * sizeof(*avc->streams))))
|
||||
goto sdp_done;
|
||||
#endif
|
||||
if (avc->nb_streams >= INT_MAX/sizeof(*avs) ||
|
||||
!(avs = av_malloc(avc->nb_streams * sizeof(*avs))))
|
||||
goto sdp_done;
|
||||
@@ -2956,8 +2961,10 @@ static int prepare_sdp_description(FFStream *stream, uint8_t **pbuffer,
|
||||
av_sdp_create(&avc, 1, *pbuffer, 2048);
|
||||
|
||||
sdp_done:
|
||||
#if !FF_API_MAX_STREAMS
|
||||
av_free(avc->streams);
|
||||
av_dict_free(&avc->metadata);
|
||||
#endif
|
||||
av_metadata_free(&avc->metadata);
|
||||
av_free(avc);
|
||||
av_free(avs);
|
||||
|
||||
@@ -3385,9 +3392,6 @@ static int rtp_new_av_stream(HTTPContext *c,
|
||||
if (!st)
|
||||
goto fail;
|
||||
ctx->nb_streams = 1;
|
||||
ctx->streams = av_mallocz(sizeof(AVStream *) * ctx->nb_streams);
|
||||
if (!ctx->streams)
|
||||
goto fail;
|
||||
ctx->streams[0] = st;
|
||||
|
||||
if (!c->stream->feed ||
|
||||
@@ -3421,7 +3425,7 @@ static int rtp_new_av_stream(HTTPContext *c,
|
||||
"rtp://%s:%d", ipaddr, ntohs(dest_addr->sin_port));
|
||||
}
|
||||
|
||||
if (url_open(&h, ctx->filename, AVIO_FLAG_WRITE) < 0)
|
||||
if (url_open(&h, ctx->filename, AVIO_WRONLY) < 0)
|
||||
goto fail;
|
||||
c->rtp_handles[stream_index] = h;
|
||||
max_packet_size = url_get_max_packet_size(h);
|
||||
@@ -3674,7 +3678,7 @@ static void build_feed_streams(void)
|
||||
for(feed = first_feed; feed != NULL; feed = feed->next_feed) {
|
||||
int fd;
|
||||
|
||||
if (avio_check(feed->feed_filename, AVIO_FLAG_READ) > 0) {
|
||||
if (url_exist(feed->feed_filename)) {
|
||||
/* See if it matches */
|
||||
AVFormatContext *s = NULL;
|
||||
int matches = 0;
|
||||
@@ -3747,7 +3751,7 @@ static void build_feed_streams(void)
|
||||
unlink(feed->feed_filename);
|
||||
}
|
||||
}
|
||||
if (avio_check(feed->feed_filename, AVIO_FLAG_WRITE) <= 0) {
|
||||
if (!url_exist(feed->feed_filename)) {
|
||||
AVFormatContext s1 = {0}, *s = &s1;
|
||||
|
||||
if (feed->readonly) {
|
||||
@@ -3757,15 +3761,20 @@ static void build_feed_streams(void)
|
||||
}
|
||||
|
||||
/* only write the header of the ffm file */
|
||||
if (avio_open(&s->pb, feed->feed_filename, AVIO_FLAG_WRITE) < 0) {
|
||||
if (avio_open(&s->pb, feed->feed_filename, AVIO_WRONLY) < 0) {
|
||||
http_log("Could not open output feed file '%s'\n",
|
||||
feed->feed_filename);
|
||||
exit(1);
|
||||
}
|
||||
s->oformat = feed->fmt;
|
||||
s->nb_streams = feed->nb_streams;
|
||||
s->streams = feed->streams;
|
||||
if (avformat_write_header(s, NULL) < 0) {
|
||||
for(i=0;i<s->nb_streams;i++) {
|
||||
AVStream *st;
|
||||
st = feed->streams[i];
|
||||
s->streams[i] = st;
|
||||
}
|
||||
av_set_parameters(s, NULL);
|
||||
if (av_write_header(s) < 0) {
|
||||
http_log("Container doesn't supports the required parameters\n");
|
||||
exit(1);
|
||||
}
|
||||
|
@@ -694,10 +694,13 @@ static int decode_i_frame(FourXContext *f, const uint8_t *buf, int length){
|
||||
unsigned int prestream_size;
|
||||
const uint8_t *prestream;
|
||||
|
||||
if (bitstream_size > (1<<26) || length < bitstream_size + 12)
|
||||
return -1;
|
||||
prestream_size = 4*AV_RL32(buf + bitstream_size + 4);
|
||||
prestream = buf + bitstream_size + 12;
|
||||
if (length < bitstream_size + 12) {
|
||||
av_log(f->avctx, AV_LOG_ERROR, "packet size too small\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
prestream_size = 4 * AV_RL32(buf + bitstream_size + 4);
|
||||
prestream = buf + bitstream_size + 12;
|
||||
|
||||
if (prestream_size > (1<<26) ||
|
||||
prestream_size != length - (bitstream_size + 12)){
|
||||
|
@@ -50,8 +50,6 @@ typedef struct EightBpsContext {
|
||||
|
||||
unsigned char planes;
|
||||
unsigned char planemap[4];
|
||||
|
||||
uint32_t pal[256];
|
||||
} EightBpsContext;
|
||||
|
||||
|
||||
@@ -131,16 +129,13 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac
|
||||
}
|
||||
}
|
||||
|
||||
if (avctx->bits_per_coded_sample <= 8) {
|
||||
const uint8_t *pal = av_packet_get_side_data(avpkt,
|
||||
AV_PKT_DATA_PALETTE,
|
||||
NULL);
|
||||
if (pal) {
|
||||
if (avctx->palctrl) {
|
||||
memcpy (c->pic.data[1], avctx->palctrl->palette, AVPALETTE_SIZE);
|
||||
if (avctx->palctrl->palette_changed) {
|
||||
c->pic.palette_has_changed = 1;
|
||||
memcpy(c->pal, pal, AVPALETTE_SIZE);
|
||||
}
|
||||
|
||||
memcpy (c->pic.data[1], c->pal, AVPALETTE_SIZE);
|
||||
avctx->palctrl->palette_changed = 0;
|
||||
} else
|
||||
c->pic.palette_has_changed = 0;
|
||||
}
|
||||
|
||||
*data_size = sizeof(AVFrame);
|
||||
@@ -170,6 +165,10 @@ static av_cold int decode_init(AVCodecContext *avctx)
|
||||
avctx->pix_fmt = PIX_FMT_PAL8;
|
||||
c->planes = 1;
|
||||
c->planemap[0] = 0; // 1st plane is palette indexes
|
||||
if (avctx->palctrl == NULL) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Error: PAL8 format but no palette from demuxer.\n");
|
||||
return -1;
|
||||
}
|
||||
break;
|
||||
case 24:
|
||||
avctx->pix_fmt = avctx->get_format(avctx, pixfmt_rgb24);
|
||||
|
@@ -15,6 +15,7 @@ OBJS = allcodecs.o \
|
||||
fmtconvert.o \
|
||||
imgconvert.o \
|
||||
jrevdct.o \
|
||||
opt.o \
|
||||
options.o \
|
||||
parser.o \
|
||||
raw.o \
|
||||
|
@@ -1185,7 +1185,7 @@ static void sbr_qmf_synthesis(DSPContext *dsp, FFTContext *mdct,
|
||||
const float *sbr_qmf_window = div ? sbr_qmf_window_ds : sbr_qmf_window_us;
|
||||
float *v;
|
||||
for (i = 0; i < 32; i++) {
|
||||
if (*v_off == 0) {
|
||||
if (*v_off < 128 >> div) {
|
||||
int saved_samples = (1280 - 128) >> div;
|
||||
memcpy(&v0[SBR_SYNTHESIS_BUF_SIZE - saved_samples], v0, saved_samples * sizeof(float));
|
||||
*v_off = SBR_SYNTHESIS_BUF_SIZE - saved_samples - (128 >> div);
|
||||
|
@@ -395,6 +395,8 @@ static int decodeTonalComponents (GetBitContext *gb, tonal_component *pComponent
|
||||
|
||||
for (k=0; k<coded_components; k++) {
|
||||
sfIndx = get_bits(gb,6);
|
||||
if(component_count>=64)
|
||||
return AVERROR_INVALIDDATA;
|
||||
pComponent[component_count].pos = j * 64 + (get_bits(gb,6));
|
||||
max_coded_values = 1024 - pComponent[component_count].pos;
|
||||
coded_values = coded_values_per_component + 1;
|
||||
|
@@ -30,9 +30,16 @@
|
||||
#include "libavutil/samplefmt.h"
|
||||
#include "libavutil/avutil.h"
|
||||
#include "libavutil/cpu.h"
|
||||
#include "libavutil/dict.h"
|
||||
|
||||
#include "libavcodec/version.h"
|
||||
|
||||
#if LIBAVCODEC_VERSION_MAJOR < 53
|
||||
# define FF_INTERNALC_MEM_TYPE unsigned int
|
||||
#else
|
||||
# define FF_INTERNALC_MEM_TYPE size_t
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Identify the syntax and semantics of the bitstream.
|
||||
* The principle is roughly:
|
||||
@@ -111,6 +118,9 @@ enum CodecID {
|
||||
CODEC_ID_QDRAW,
|
||||
CODEC_ID_VIXL,
|
||||
CODEC_ID_QPEG,
|
||||
#if LIBAVCODEC_VERSION_MAJOR < 53
|
||||
CODEC_ID_XVID,
|
||||
#endif
|
||||
CODEC_ID_PNG,
|
||||
CODEC_ID_PPM,
|
||||
CODEC_ID_PBM,
|
||||
@@ -359,6 +369,18 @@ enum CodecID {
|
||||
CODEC_ID_FFMETADATA=0x21000, ///< Dummy codec for streams containing only metadata information.
|
||||
};
|
||||
|
||||
#if LIBAVCODEC_VERSION_MAJOR < 53
|
||||
#define CodecType AVMediaType
|
||||
|
||||
#define CODEC_TYPE_UNKNOWN AVMEDIA_TYPE_UNKNOWN
|
||||
#define CODEC_TYPE_VIDEO AVMEDIA_TYPE_VIDEO
|
||||
#define CODEC_TYPE_AUDIO AVMEDIA_TYPE_AUDIO
|
||||
#define CODEC_TYPE_DATA AVMEDIA_TYPE_DATA
|
||||
#define CODEC_TYPE_SUBTITLE AVMEDIA_TYPE_SUBTITLE
|
||||
#define CODEC_TYPE_ATTACHMENT AVMEDIA_TYPE_ATTACHMENT
|
||||
#define CODEC_TYPE_NB AVMEDIA_TYPE_NB
|
||||
#endif
|
||||
|
||||
#if FF_API_OLD_SAMPLE_FMT
|
||||
#define SampleFormat AVSampleFormat
|
||||
|
||||
@@ -1070,10 +1092,6 @@ typedef struct AVPanScan{
|
||||
#define FF_BUFFER_HINTS_PRESERVE 0x04 // User must not alter buffer content.
|
||||
#define FF_BUFFER_HINTS_REUSABLE 0x08 // Codec will reuse the buffer (update).
|
||||
|
||||
enum AVPacketSideDataType {
|
||||
AV_PKT_DATA_PALETTE,
|
||||
};
|
||||
|
||||
typedef struct AVPacket {
|
||||
/**
|
||||
* Presentation timestamp in AVStream->time_base units; the time at which
|
||||
@@ -1095,17 +1113,6 @@ typedef struct AVPacket {
|
||||
int size;
|
||||
int stream_index;
|
||||
int flags;
|
||||
/**
|
||||
* Additional packet data that can be provided by the container.
|
||||
* Packet can contain several types of side information.
|
||||
*/
|
||||
struct {
|
||||
uint8_t *data;
|
||||
int size;
|
||||
enum AVPacketSideDataType type;
|
||||
} *side_data;
|
||||
int side_data_elems;
|
||||
|
||||
/**
|
||||
* Duration of this packet in AVStream->time_base units, 0 if unknown.
|
||||
* Equals next_pts - this_pts in presentation order.
|
||||
@@ -1135,6 +1142,9 @@ typedef struct AVPacket {
|
||||
int64_t convergence_duration;
|
||||
} AVPacket;
|
||||
#define AV_PKT_FLAG_KEY 0x0001
|
||||
#if LIBAVCODEC_VERSION_MAJOR < 53
|
||||
#define PKT_FLAG_KEY AV_PKT_FLAG_KEY
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Audio Video Frame.
|
||||
@@ -1255,6 +1265,16 @@ typedef struct AVCodecContext {
|
||||
*/
|
||||
enum PixelFormat pix_fmt;
|
||||
|
||||
#if FF_API_RATE_EMU
|
||||
/**
|
||||
* Frame rate emulation. If not zero, the lower layer (i.e. format handler)
|
||||
* has to read frames at native frame rate.
|
||||
* - encoding: Set by user.
|
||||
* - decoding: unused
|
||||
*/
|
||||
attribute_deprecated int rate_emu;
|
||||
#endif
|
||||
|
||||
/**
|
||||
* If non NULL, 'draw_horiz_band' is called by the libavcodec
|
||||
* decoder to draw a horizontal band. It improves cache usage. Not
|
||||
@@ -1299,6 +1319,9 @@ typedef struct AVCodecContext {
|
||||
*/
|
||||
int frame_size;
|
||||
int frame_number; ///< audio or video frame number
|
||||
#if LIBAVCODEC_VERSION_MAJOR < 53
|
||||
int real_pict_num; ///< Returns the real picture number of previous encoded frame.
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Number of frames the decoded output will be delayed relative to
|
||||
@@ -1356,6 +1379,16 @@ typedef struct AVCodecContext {
|
||||
|
||||
int b_frame_strategy;
|
||||
|
||||
#if FF_API_HURRY_UP
|
||||
/**
|
||||
* hurry up amount
|
||||
* - encoding: unused
|
||||
* - decoding: Set by user. 1-> Skip B-frames, 2-> Skip IDCT/dequant too, 5-> Skip everything except header
|
||||
* @deprecated Deprecated in favor of skip_idct and skip_frame.
|
||||
*/
|
||||
attribute_deprecated int hurry_up;
|
||||
#endif
|
||||
|
||||
struct AVCodec *codec;
|
||||
|
||||
void *priv_data;
|
||||
@@ -1473,6 +1506,9 @@ typedef struct AVCodecContext {
|
||||
#define FF_COMPLIANCE_VERY_STRICT 2 ///< Strictly conform to an older more strict version of the spec or reference software.
|
||||
#define FF_COMPLIANCE_STRICT 1 ///< Strictly conform to all the things in the spec no matter what consequences.
|
||||
#define FF_COMPLIANCE_NORMAL 0
|
||||
#if FF_API_INOFFICIAL
|
||||
#define FF_COMPLIANCE_INOFFICIAL -1 ///< Allow inofficial extensions (deprecated - use FF_COMPLIANCE_UNOFFICIAL instead).
|
||||
#endif
|
||||
#define FF_COMPLIANCE_UNOFFICIAL -1 ///< Allow unofficial extensions
|
||||
#define FF_COMPLIANCE_EXPERIMENTAL -2 ///< Allow nonstandardized experimental things.
|
||||
|
||||
@@ -1746,6 +1782,25 @@ typedef struct AVCodecContext {
|
||||
*/
|
||||
unsigned dsp_mask;
|
||||
|
||||
#if FF_API_MM_FLAGS
|
||||
#define FF_MM_FORCE AV_CPU_FLAG_FORCE
|
||||
#define FF_MM_MMX AV_CPU_FLAG_MMX
|
||||
#define FF_MM_3DNOW AV_CPU_FLAG_3DNOW
|
||||
#define FF_MM_MMXEXT AV_CPU_FLAG_MMX2
|
||||
#define FF_MM_MMX2 AV_CPU_FLAG_MMX2
|
||||
#define FF_MM_SSE AV_CPU_FLAG_SSE
|
||||
#define FF_MM_SSE2 AV_CPU_FLAG_SSE2
|
||||
#define FF_MM_SSE2SLOW AV_CPU_FLAG_SSE2SLOW
|
||||
#define FF_MM_3DNOWEXT AV_CPU_FLAG_3DNOWEXT
|
||||
#define FF_MM_SSE3 AV_CPU_FLAG_SSE3
|
||||
#define FF_MM_SSE3SLOW AV_CPU_FLAG_SSE3SLOW
|
||||
#define FF_MM_SSSE3 AV_CPU_FLAG_SSSE3
|
||||
#define FF_MM_SSE4 AV_CPU_FLAG_SSE4
|
||||
#define FF_MM_SSE42 AV_CPU_FLAG_SSE42
|
||||
#define FF_MM_IWMMXT AV_CPU_FLAG_IWMMXT
|
||||
#define FF_MM_ALTIVEC AV_CPU_FLAG_ALTIVEC
|
||||
#endif
|
||||
|
||||
/**
|
||||
* bits per sample/pixel from the demuxer (needed for huffyuv).
|
||||
* - encoding: Set by libavcodec.
|
||||
@@ -1820,6 +1875,22 @@ typedef struct AVCodecContext {
|
||||
*/
|
||||
uint64_t error[4];
|
||||
|
||||
#if FF_API_MB_Q
|
||||
/**
|
||||
* minimum MB quantizer
|
||||
* - encoding: unused
|
||||
* - decoding: unused
|
||||
*/
|
||||
attribute_deprecated int mb_qmin;
|
||||
|
||||
/**
|
||||
* maximum MB quantizer
|
||||
* - encoding: unused
|
||||
* - decoding: unused
|
||||
*/
|
||||
attribute_deprecated int mb_qmax;
|
||||
#endif
|
||||
|
||||
/**
|
||||
* motion estimation comparison function
|
||||
* - encoding: Set by user.
|
||||
@@ -2521,6 +2592,23 @@ typedef struct AVCodecContext {
|
||||
int compression_level;
|
||||
#define FF_COMPRESSION_DEFAULT -1
|
||||
|
||||
#if FF_API_USE_LPC
|
||||
/**
|
||||
* Sets whether to use LPC mode - used by FLAC encoder.
|
||||
* - encoding: Set by user.
|
||||
* - decoding: unused
|
||||
* @deprecated Deprecated in favor of lpc_type and lpc_passes.
|
||||
*/
|
||||
int use_lpc;
|
||||
|
||||
/**
|
||||
* LPC coefficient precision - used by FLAC encoder
|
||||
* - encoding: Set by user.
|
||||
* - decoding: unused
|
||||
*/
|
||||
int lpc_coeff_precision;
|
||||
#endif
|
||||
|
||||
/**
|
||||
* - encoding: Set by user.
|
||||
* - decoding: unused
|
||||
@@ -2540,13 +2628,6 @@ typedef struct AVCodecContext {
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* LPC coefficient precision - used by FLAC encoder
|
||||
* - encoding: Set by user.
|
||||
* - decoding: unused
|
||||
*/
|
||||
attribute_deprecated int lpc_coeff_precision;
|
||||
|
||||
/**
|
||||
* search method for selecting prediction order
|
||||
* - encoding: Set by user.
|
||||
@@ -3210,33 +3291,6 @@ int av_dup_packet(AVPacket *pkt);
|
||||
*/
|
||||
void av_free_packet(AVPacket *pkt);
|
||||
|
||||
/**
|
||||
* Allocate new information of a packet.
|
||||
*
|
||||
* @param pkt packet
|
||||
* @param type side information type
|
||||
* @param size side information size
|
||||
* @return pointer to fresh allocated data or NULL otherwise
|
||||
*/
|
||||
uint8_t* av_packet_new_side_data(AVPacket *pkt, enum AVPacketSideDataType type,
|
||||
int size);
|
||||
|
||||
/**
|
||||
* Get side information from packet.
|
||||
*
|
||||
* @param pkt packet
|
||||
* @param type desired side information type
|
||||
* @param size pointer for side information size to store (optional)
|
||||
* @return pointer to data if present or NULL otherwise
|
||||
*/
|
||||
uint8_t* av_packet_get_side_data(AVPacket *pkt, enum AVPacketSideDataType type,
|
||||
int *size);
|
||||
|
||||
int av_packet_merge_side_data(AVPacket *pkt);
|
||||
|
||||
int av_packet_split_side_data(AVPacket *pkt);
|
||||
|
||||
|
||||
/* resample.c */
|
||||
|
||||
struct ReSampleContext;
|
||||
@@ -3244,6 +3298,14 @@ struct AVResampleContext;
|
||||
|
||||
typedef struct ReSampleContext ReSampleContext;
|
||||
|
||||
#if FF_API_AUDIO_OLD
|
||||
/**
|
||||
* @deprecated Use av_audio_resample_init() instead.
|
||||
*/
|
||||
attribute_deprecated ReSampleContext *audio_resample_init(int output_channels, int input_channels,
|
||||
int output_rate, int input_rate);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Initialize audio resampling context.
|
||||
*
|
||||
@@ -3407,6 +3469,23 @@ const char *avcodec_get_pix_fmt_name(enum PixelFormat pix_fmt);
|
||||
|
||||
void avcodec_set_dimensions(AVCodecContext *s, int width, int height);
|
||||
|
||||
#if LIBAVCODEC_VERSION_MAJOR < 53
|
||||
/**
|
||||
* Return the pixel format corresponding to the name name.
|
||||
*
|
||||
* If there is no pixel format with name name, then look for a
|
||||
* pixel format with the name corresponding to the native endian
|
||||
* format of name.
|
||||
* For example in a little-endian system, first look for "gray16",
|
||||
* then for "gray16le".
|
||||
*
|
||||
* Finally if no pixel format has been found, return PIX_FMT_NONE.
|
||||
*
|
||||
* @deprecated Deprecated in favor of av_get_pix_fmt().
|
||||
*/
|
||||
attribute_deprecated enum PixelFormat avcodec_get_pix_fmt(const char* name);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Return a value representing the fourCC code associated to the
|
||||
* pixel format pix_fmt, or 0 if no associated fourCC code can be
|
||||
@@ -3475,6 +3554,14 @@ int avcodec_get_pix_fmt_loss(enum PixelFormat dst_pix_fmt, enum PixelFormat src_
|
||||
enum PixelFormat avcodec_find_best_pix_fmt(int64_t pix_fmt_mask, enum PixelFormat src_pix_fmt,
|
||||
int has_alpha, int *loss_ptr);
|
||||
|
||||
#if LIBAVCODEC_VERSION_MAJOR < 53
|
||||
/**
|
||||
* @deprecated Use av_get_pix_fmt_string() instead.
|
||||
*/
|
||||
attribute_deprecated
|
||||
void avcodec_pix_fmt_string (char *buf, int buf_size, enum PixelFormat pix_fmt);
|
||||
#endif
|
||||
|
||||
#define FF_ALPHA_TRANSP 0x0001 /* image has some totally transparent pixels */
|
||||
#define FF_ALPHA_SEMI_TRANSP 0x0002 /* image has some transparent pixels */
|
||||
|
||||
@@ -3525,6 +3612,13 @@ const char *avcodec_license(void);
|
||||
*/
|
||||
void avcodec_init(void);
|
||||
|
||||
#if LIBAVCODEC_VERSION_MAJOR < 53
|
||||
/**
|
||||
* @deprecated Deprecated in favor of avcodec_register().
|
||||
*/
|
||||
attribute_deprecated void register_avcodec(AVCodec *codec);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Register the codec codec and initialize libavcodec.
|
||||
*
|
||||
@@ -3669,6 +3763,14 @@ void avcodec_align_dimensions(AVCodecContext *s, int *width, int *height);
|
||||
void avcodec_align_dimensions2(AVCodecContext *s, int *width, int *height,
|
||||
int linesize_align[4]);
|
||||
|
||||
#if LIBAVCODEC_VERSION_MAJOR < 53
|
||||
/**
|
||||
* @deprecated Deprecated in favor of av_check_image_size().
|
||||
*/
|
||||
attribute_deprecated
|
||||
int avcodec_check_dimensions(void *av_log_ctx, unsigned int w, unsigned int h);
|
||||
#endif
|
||||
|
||||
enum PixelFormat avcodec_default_get_format(struct AVCodecContext *s, const enum PixelFormat * fmt);
|
||||
|
||||
#if FF_API_THREAD_INIT
|
||||
@@ -3677,12 +3779,13 @@ enum PixelFormat avcodec_default_get_format(struct AVCodecContext *s, const enum
|
||||
*/
|
||||
attribute_deprecated
|
||||
int avcodec_thread_init(AVCodecContext *s, int thread_count);
|
||||
void avcodec_thread_free(AVCodecContext *s);
|
||||
#endif
|
||||
|
||||
int avcodec_default_execute(AVCodecContext *c, int (*func)(AVCodecContext *c2, void *arg2),void *arg, int *ret, int count, int size);
|
||||
int avcodec_default_execute2(AVCodecContext *c, int (*func)(AVCodecContext *c2, void *arg2, int, int),void *arg, int *ret, int count);
|
||||
//FIXME func typedef
|
||||
|
||||
#if FF_API_AVCODEC_OPEN
|
||||
/**
|
||||
* Initialize the AVCodecContext to use the given AVCodec. Prior to using this
|
||||
* function the context has to be allocated.
|
||||
@@ -3709,8 +3812,63 @@ int avcodec_default_execute2(AVCodecContext *c, int (*func)(AVCodecContext *c2,
|
||||
* @param codec The codec to use within the context.
|
||||
* @return zero on success, a negative value on error
|
||||
* @see avcodec_alloc_context, avcodec_find_decoder, avcodec_find_encoder, avcodec_close
|
||||
*
|
||||
* @deprecated use avcodec_open2
|
||||
*/
|
||||
int avcodec_open(AVCodecContext *avctx, AVCodec *codec);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Initialize the AVCodecContext to use the given AVCodec. Prior to using this
|
||||
* function the context has to be allocated with avcodec_alloc_context().
|
||||
*
|
||||
* The functions avcodec_find_decoder_by_name(), avcodec_find_encoder_by_name(),
|
||||
* avcodec_find_decoder() and avcodec_find_encoder() provide an easy way for
|
||||
* retrieving a codec.
|
||||
*
|
||||
* @warning This function is not thread safe!
|
||||
*
|
||||
* @code
|
||||
* avcodec_register_all();
|
||||
* av_dict_set(&opts, "b", "2.5M", 0);
|
||||
* codec = avcodec_find_decoder(CODEC_ID_H264);
|
||||
* if (!codec)
|
||||
* exit(1);
|
||||
*
|
||||
* context = avcodec_alloc_context();
|
||||
*
|
||||
* if (avcodec_open(context, codec, opts) < 0)
|
||||
* exit(1);
|
||||
* @endcode
|
||||
*
|
||||
* @param avctx The context to initialize.
|
||||
* @param options A dictionary filled with AVCodecContext and codec-private options.
|
||||
* On return this object will be filled with options that were not found.
|
||||
*
|
||||
* @return zero on success, a negative value on error
|
||||
* @see avcodec_alloc_context3(), avcodec_find_decoder(), avcodec_find_encoder(),
|
||||
* av_dict_set(), av_opt_find().
|
||||
*/
|
||||
int avcodec_open2(AVCodecContext *avctx, AVCodec *codec, AVDictionary **options);
|
||||
|
||||
#if FF_API_AUDIO_OLD
|
||||
/**
|
||||
* Decode an audio frame from buf into samples.
|
||||
* Wrapper function which calls avcodec_decode_audio3.
|
||||
*
|
||||
* @deprecated Use avcodec_decode_audio3 instead.
|
||||
* @param avctx the codec context
|
||||
* @param[out] samples the output buffer
|
||||
* @param[in,out] frame_size_ptr the output buffer size in bytes
|
||||
* @param[in] buf the input buffer
|
||||
* @param[in] buf_size the input buffer size in bytes
|
||||
* @return On error a negative value is returned, otherwise the number of bytes
|
||||
* used or zero if no frame could be decompressed.
|
||||
*/
|
||||
attribute_deprecated int avcodec_decode_audio2(AVCodecContext *avctx, int16_t *samples,
|
||||
int *frame_size_ptr,
|
||||
const uint8_t *buf, int buf_size);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Decode the audio frame of size avpkt->size from avpkt->data into samples.
|
||||
@@ -3755,6 +3913,25 @@ int avcodec_decode_audio3(AVCodecContext *avctx, int16_t *samples,
|
||||
int *frame_size_ptr,
|
||||
AVPacket *avpkt);
|
||||
|
||||
#if FF_API_VIDEO_OLD
|
||||
/**
|
||||
* Decode a video frame from buf into picture.
|
||||
* Wrapper function which calls avcodec_decode_video2.
|
||||
*
|
||||
* @deprecated Use avcodec_decode_video2 instead.
|
||||
* @param avctx the codec context
|
||||
* @param[out] picture The AVFrame in which the decoded video frame will be stored.
|
||||
* @param[in] buf the input buffer
|
||||
* @param[in] buf_size the size of the input buffer in bytes
|
||||
* @param[in,out] got_picture_ptr Zero if no frame could be decompressed, otherwise, it is nonzero.
|
||||
* @return On error a negative value is returned, otherwise the number of bytes
|
||||
* used or zero if no frame could be decompressed.
|
||||
*/
|
||||
attribute_deprecated int avcodec_decode_video(AVCodecContext *avctx, AVFrame *picture,
|
||||
int *got_picture_ptr,
|
||||
const uint8_t *buf, int buf_size);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Decode the video frame of size avpkt->size from avpkt->data into picture.
|
||||
* Some decoders may support multiple frames in a single AVPacket, such
|
||||
@@ -3799,6 +3976,15 @@ int avcodec_decode_video2(AVCodecContext *avctx, AVFrame *picture,
|
||||
int *got_picture_ptr,
|
||||
AVPacket *avpkt);
|
||||
|
||||
#if FF_API_SUBTITLE_OLD
|
||||
/* Decode a subtitle message. Return -1 if error, otherwise return the
|
||||
* number of bytes used. If no subtitle could be decompressed,
|
||||
* got_sub_ptr is zero. Otherwise, the subtitle is stored in *sub. */
|
||||
attribute_deprecated int avcodec_decode_subtitle(AVCodecContext *avctx, AVSubtitle *sub,
|
||||
int *got_sub_ptr,
|
||||
const uint8_t *buf, int buf_size);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Decode a subtitle message.
|
||||
* Return a negative value on error, otherwise return the number of bytes used.
|
||||
@@ -4067,6 +4253,15 @@ AVCodecParser *av_parser_next(AVCodecParser *c);
|
||||
void av_register_codec_parser(AVCodecParser *parser);
|
||||
AVCodecParserContext *av_parser_init(int codec_id);
|
||||
|
||||
#if LIBAVCODEC_VERSION_MAJOR < 53
|
||||
attribute_deprecated
|
||||
int av_parser_parse(AVCodecParserContext *s,
|
||||
AVCodecContext *avctx,
|
||||
uint8_t **poutbuf, int *poutbuf_size,
|
||||
const uint8_t *buf, int buf_size,
|
||||
int64_t pts, int64_t dts);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Parse a packet.
|
||||
*
|
||||
@@ -4145,7 +4340,7 @@ AVBitStreamFilter *av_bitstream_filter_next(AVBitStreamFilter *f);
|
||||
*
|
||||
* @see av_realloc
|
||||
*/
|
||||
void *av_fast_realloc(void *ptr, unsigned int *size, size_t min_size);
|
||||
void *av_fast_realloc(void *ptr, unsigned int *size, FF_INTERNALC_MEM_TYPE min_size);
|
||||
|
||||
/**
|
||||
* Allocate a buffer, reusing the given one if large enough.
|
||||
@@ -4159,7 +4354,17 @@ void *av_fast_realloc(void *ptr, unsigned int *size, size_t min_size);
|
||||
* @param min_size minimum size of *ptr buffer after returning, *ptr will be NULL and
|
||||
* *size 0 if an error occurred.
|
||||
*/
|
||||
void av_fast_malloc(void *ptr, unsigned int *size, size_t min_size);
|
||||
void av_fast_malloc(void *ptr, unsigned int *size, FF_INTERNALC_MEM_TYPE min_size);
|
||||
|
||||
#if LIBAVCODEC_VERSION_MAJOR < 53
|
||||
/**
|
||||
* @deprecated Deprecated in favor of av_image_copy().
|
||||
*/
|
||||
attribute_deprecated
|
||||
void av_picture_data_copy(uint8_t *dst_data[4], int dst_linesize[4],
|
||||
uint8_t *src_data[4], int src_linesize[4],
|
||||
enum PixelFormat pix_fmt, int width, int height);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Copy image src to dst. Wraps av_picture_data_copy() above.
|
||||
@@ -4188,6 +4393,22 @@ int av_picture_pad(AVPicture *dst, const AVPicture *src, int height, int width,
|
||||
*/
|
||||
unsigned int av_xiphlacing(unsigned char *s, unsigned int v);
|
||||
|
||||
#if LIBAVCODEC_VERSION_MAJOR < 53
|
||||
/**
|
||||
* Parse str and put in width_ptr and height_ptr the detected values.
|
||||
*
|
||||
* @deprecated Deprecated in favor of av_parse_video_size().
|
||||
*/
|
||||
attribute_deprecated int av_parse_video_frame_size(int *width_ptr, int *height_ptr, const char *str);
|
||||
|
||||
/**
|
||||
* Parse str and store the detected values in *frame_rate.
|
||||
*
|
||||
* @deprecated Deprecated in favor of av_parse_video_rate().
|
||||
*/
|
||||
attribute_deprecated int av_parse_video_frame_rate(AVRational *frame_rate, const char *str);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Logs a generic warning message about a missing feature. This function is
|
||||
* intended to be used internally by FFmpeg (libavcodec, libavformat, etc.)
|
||||
|
@@ -26,21 +26,12 @@
|
||||
void av_destruct_packet_nofree(AVPacket *pkt)
|
||||
{
|
||||
pkt->data = NULL; pkt->size = 0;
|
||||
pkt->side_data = NULL;
|
||||
pkt->side_data_elems = 0;
|
||||
}
|
||||
|
||||
void av_destruct_packet(AVPacket *pkt)
|
||||
{
|
||||
int i;
|
||||
|
||||
av_free(pkt->data);
|
||||
pkt->data = NULL; pkt->size = 0;
|
||||
|
||||
for (i = 0; i < pkt->side_data_elems; i++)
|
||||
av_free(pkt->side_data[i].data);
|
||||
av_freep(&pkt->side_data);
|
||||
pkt->side_data_elems = 0;
|
||||
}
|
||||
|
||||
void av_init_packet(AVPacket *pkt)
|
||||
@@ -53,8 +44,6 @@ void av_init_packet(AVPacket *pkt)
|
||||
pkt->flags = 0;
|
||||
pkt->stream_index = 0;
|
||||
pkt->destruct= NULL;
|
||||
pkt->side_data = NULL;
|
||||
pkt->side_data_elems = 0;
|
||||
}
|
||||
|
||||
int av_new_packet(AVPacket *pkt, int size)
|
||||
@@ -100,52 +89,23 @@ int av_grow_packet(AVPacket *pkt, int grow_by)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define DUP_DATA(dst, src, size, padding) \
|
||||
do { \
|
||||
void *data; \
|
||||
if (padding) { \
|
||||
if ((unsigned)(size) > (unsigned)(size) + FF_INPUT_BUFFER_PADDING_SIZE) \
|
||||
goto failed_alloc; \
|
||||
data = av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE); \
|
||||
} else { \
|
||||
data = av_malloc(size); \
|
||||
} \
|
||||
if (!data) \
|
||||
goto failed_alloc; \
|
||||
memcpy(data, src, size); \
|
||||
if (padding) \
|
||||
memset((uint8_t*)data + size, 0, FF_INPUT_BUFFER_PADDING_SIZE); \
|
||||
dst = data; \
|
||||
} while(0)
|
||||
|
||||
int av_dup_packet(AVPacket *pkt)
|
||||
{
|
||||
AVPacket tmp_pkt;
|
||||
|
||||
if (((pkt->destruct == av_destruct_packet_nofree) || (pkt->destruct == NULL)) && pkt->data) {
|
||||
tmp_pkt = *pkt;
|
||||
|
||||
pkt->data = NULL;
|
||||
pkt->side_data = NULL;
|
||||
DUP_DATA(pkt->data, tmp_pkt.data, pkt->size, 1);
|
||||
pkt->destruct = av_destruct_packet;
|
||||
|
||||
if (pkt->side_data_elems) {
|
||||
int i;
|
||||
|
||||
DUP_DATA(pkt->side_data, tmp_pkt.side_data,
|
||||
pkt->side_data_elems * sizeof(*pkt->side_data), 0);
|
||||
memset(pkt->side_data, 0, pkt->side_data_elems * sizeof(*pkt->side_data));
|
||||
for (i = 0; i < pkt->side_data_elems; i++) {
|
||||
DUP_DATA(pkt->side_data[i].data, tmp_pkt.side_data[i].data,
|
||||
pkt->side_data[i].size, 1);
|
||||
}
|
||||
uint8_t *data;
|
||||
/* We duplicate the packet and don't forget to add the padding again. */
|
||||
if((unsigned)pkt->size > (unsigned)pkt->size + FF_INPUT_BUFFER_PADDING_SIZE)
|
||||
return AVERROR(ENOMEM);
|
||||
data = av_malloc(pkt->size + FF_INPUT_BUFFER_PADDING_SIZE);
|
||||
if (!data) {
|
||||
return AVERROR(ENOMEM);
|
||||
}
|
||||
memcpy(data, pkt->data, pkt->size);
|
||||
memset(data + pkt->size, 0, FF_INPUT_BUFFER_PADDING_SIZE);
|
||||
pkt->data = data;
|
||||
pkt->destruct = av_destruct_packet;
|
||||
}
|
||||
return 0;
|
||||
failed_alloc:
|
||||
av_destruct_packet(pkt);
|
||||
return AVERROR(ENOMEM);
|
||||
}
|
||||
|
||||
void av_free_packet(AVPacket *pkt)
|
||||
@@ -153,125 +113,6 @@ void av_free_packet(AVPacket *pkt)
|
||||
if (pkt) {
|
||||
if (pkt->destruct) pkt->destruct(pkt);
|
||||
pkt->data = NULL; pkt->size = 0;
|
||||
pkt->side_data = NULL;
|
||||
pkt->side_data_elems = 0;
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t* av_packet_new_side_data(AVPacket *pkt, enum AVPacketSideDataType type,
|
||||
int size)
|
||||
{
|
||||
int elems = pkt->side_data_elems;
|
||||
|
||||
if ((unsigned)elems + 1 > INT_MAX / sizeof(*pkt->side_data))
|
||||
return NULL;
|
||||
if ((unsigned)size > INT_MAX - FF_INPUT_BUFFER_PADDING_SIZE)
|
||||
return NULL;
|
||||
|
||||
pkt->side_data = av_realloc(pkt->side_data, (elems + 1) * sizeof(*pkt->side_data));
|
||||
if (!pkt->side_data)
|
||||
return NULL;
|
||||
|
||||
pkt->side_data[elems].data = av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE);
|
||||
if (!pkt->side_data[elems].data)
|
||||
return NULL;
|
||||
pkt->side_data[elems].size = size;
|
||||
pkt->side_data[elems].type = type;
|
||||
pkt->side_data_elems++;
|
||||
|
||||
return pkt->side_data[elems].data;
|
||||
}
|
||||
|
||||
uint8_t* av_packet_get_side_data(AVPacket *pkt, enum AVPacketSideDataType type,
|
||||
int *size)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < pkt->side_data_elems; i++) {
|
||||
if (pkt->side_data[i].type == type) {
|
||||
if (size)
|
||||
*size = pkt->side_data[i].size;
|
||||
return pkt->side_data[i].data;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#define FF_MERGE_MARKER 0x8c4d9d108e25e9feULL
|
||||
|
||||
int av_packet_merge_side_data(AVPacket *pkt){
|
||||
if(pkt->side_data_elems){
|
||||
int i;
|
||||
uint8_t *p;
|
||||
uint64_t size= pkt->size + 8LL + FF_INPUT_BUFFER_PADDING_SIZE;
|
||||
AVPacket old= *pkt;
|
||||
for (i=0; i<old.side_data_elems; i++) {
|
||||
size += old.side_data[i].size + 5LL;
|
||||
}
|
||||
if (size > INT_MAX)
|
||||
return AVERROR(EINVAL);
|
||||
p = av_malloc(size);
|
||||
if (!p)
|
||||
return AVERROR(ENOMEM);
|
||||
pkt->data = p;
|
||||
pkt->destruct = av_destruct_packet;
|
||||
pkt->size = size - FF_INPUT_BUFFER_PADDING_SIZE;
|
||||
bytestream_put_buffer(&p, old.data, old.size);
|
||||
for (i=old.side_data_elems-1; i>=0; i--) {
|
||||
bytestream_put_buffer(&p, old.side_data[i].data, old.side_data[i].size);
|
||||
bytestream_put_be32(&p, old.side_data[i].size);
|
||||
*p++ = old.side_data[i].type | ((i==old.side_data_elems-1)*128);
|
||||
}
|
||||
bytestream_put_be64(&p, FF_MERGE_MARKER);
|
||||
av_assert0(p-pkt->data == pkt->size);
|
||||
memset(p, 0, FF_INPUT_BUFFER_PADDING_SIZE);
|
||||
av_free_packet(&old);
|
||||
pkt->side_data_elems = 0;
|
||||
pkt->side_data = NULL;
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int av_packet_split_side_data(AVPacket *pkt){
|
||||
if (!pkt->side_data_elems && pkt->size >12 && AV_RB64(pkt->data + pkt->size - 8) == FF_MERGE_MARKER){
|
||||
int i;
|
||||
unsigned int size;
|
||||
uint8_t *p= pkt->data + pkt->size - 8 - 5;
|
||||
|
||||
av_dup_packet(pkt);
|
||||
|
||||
for (i=1; ; i++){
|
||||
size = AV_RB32(p);
|
||||
if (size>INT_MAX || p - pkt->data <= size)
|
||||
return 0;
|
||||
if (p[4]&128)
|
||||
break;
|
||||
p-= size+5;
|
||||
}
|
||||
|
||||
pkt->side_data = av_malloc(i * sizeof(*pkt->side_data));
|
||||
if (!pkt->side_data)
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
p= pkt->data + pkt->size - 8 - 5;
|
||||
for (i=0; ; i++){
|
||||
size= AV_RB32(p);
|
||||
av_assert0(size<=INT_MAX && p - pkt->data > size);
|
||||
pkt->side_data[i].data = av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE);
|
||||
pkt->side_data[i].size = size;
|
||||
pkt->side_data[i].type = p[4]&127;
|
||||
if (!pkt->side_data[i].data)
|
||||
return AVERROR(ENOMEM);
|
||||
memcpy(pkt->side_data[i].data, p-size, size);
|
||||
pkt->size -= size + 5;
|
||||
if(p[4]&128)
|
||||
break;
|
||||
p-= size+5;
|
||||
}
|
||||
pkt->size -= 8;
|
||||
pkt->side_data_elems = i+1;
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@@ -67,7 +67,6 @@ typedef struct CinepakContext {
|
||||
|
||||
int sega_film_skip_bytes;
|
||||
|
||||
uint32_t pal[256];
|
||||
} CinepakContext;
|
||||
|
||||
static void cinepak_decode_codebook (cvid_codebook *codebook,
|
||||
@@ -366,6 +365,8 @@ static int cinepak_decode (CinepakContext *s)
|
||||
s->strips[i].x2 = s->avctx->width;
|
||||
|
||||
strip_size = AV_RB24 (&s->data[1]) - 12;
|
||||
if(strip_size < 0)
|
||||
return -1;
|
||||
s->data += 12;
|
||||
strip_size = ((s->data + strip_size) > eod) ? (eod - s->data) : strip_size;
|
||||
|
||||
@@ -397,7 +398,7 @@ static av_cold int cinepak_decode_init(AVCodecContext *avctx)
|
||||
s->sega_film_skip_bytes = -1; /* uninitialized state */
|
||||
|
||||
// check for paletted data
|
||||
if (avctx->bits_per_coded_sample != 8) {
|
||||
if ((avctx->palctrl == NULL) || (avctx->bits_per_coded_sample == 40)) {
|
||||
s->palette_video = 0;
|
||||
avctx->pix_fmt = PIX_FMT_YUV420P;
|
||||
} else {
|
||||
@@ -430,18 +431,16 @@ static int cinepak_decode_frame(AVCodecContext *avctx,
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (s->palette_video) {
|
||||
const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, NULL);
|
||||
if (pal) {
|
||||
s->frame.palette_has_changed = 1;
|
||||
memcpy(s->pal, pal, AVPALETTE_SIZE);
|
||||
}
|
||||
}
|
||||
|
||||
cinepak_decode(s);
|
||||
|
||||
if (s->palette_video)
|
||||
memcpy (s->frame.data[1], s->pal, AVPALETTE_SIZE);
|
||||
if (s->palette_video) {
|
||||
memcpy (s->frame.data[1], avctx->palctrl->palette, AVPALETTE_SIZE);
|
||||
if (avctx->palctrl->palette_changed) {
|
||||
s->frame.palette_has_changed = 1;
|
||||
avctx->palctrl->palette_changed = 0;
|
||||
} else
|
||||
s->frame.palette_has_changed = 0;
|
||||
}
|
||||
|
||||
*data_size = sizeof(AVFrame);
|
||||
*(AVFrame*)data = s->frame;
|
||||
|
@@ -1079,7 +1079,7 @@ static av_cold int cook_decode_init(AVCodecContext *avctx)
|
||||
q->subpacket[s].subbands = bytestream_get_be16(&edata_ptr);
|
||||
extradata_size -= 8;
|
||||
}
|
||||
if (avctx->extradata_size >= 8){
|
||||
if (extradata_size >= 8){
|
||||
bytestream_get_be32(&edata_ptr); //Unknown unused
|
||||
q->subpacket[s].js_subband_start = bytestream_get_be16(&edata_ptr);
|
||||
q->subpacket[s].js_vlc_bits = bytestream_get_be16(&edata_ptr);
|
||||
|
@@ -120,6 +120,14 @@ void ff_bink_idct_put_c(uint8_t *dest, int linesize, DCTELEM *block);
|
||||
void ff_ea_idct_put_c(uint8_t *dest, int linesize, DCTELEM *block);
|
||||
|
||||
/* 1/2^n downscaling functions from imgconvert.c */
|
||||
#if LIBAVCODEC_VERSION_MAJOR < 53
|
||||
/**
|
||||
* @deprecated Use av_image_copy_plane() instead.
|
||||
*/
|
||||
attribute_deprecated
|
||||
void ff_img_copy_plane(uint8_t *dst, int dst_wrap, const uint8_t *src, int src_wrap, int width, int height);
|
||||
#endif
|
||||
|
||||
void ff_shrink22(uint8_t *dst, int dst_wrap, const uint8_t *src, int src_wrap, int width, int height);
|
||||
void ff_shrink44(uint8_t *dst, int dst_wrap, const uint8_t *src, int src_wrap, int width, int height);
|
||||
void ff_shrink88(uint8_t *dst, int dst_wrap, const uint8_t *src, int src_wrap, int width, int height);
|
||||
|
@@ -296,6 +296,17 @@ static av_cold int flac_encode_init(AVCodecContext *avctx)
|
||||
s->options.max_partition_order = ((int[]){ 2, 2, 3, 3, 3, 8, 8, 8, 8, 8, 8, 8, 8})[level];
|
||||
|
||||
/* set compression option overrides from AVCodecContext */
|
||||
#if FF_API_USE_LPC
|
||||
/* for compatibility with deprecated AVCodecContext.use_lpc */
|
||||
if (avctx->use_lpc == 0) {
|
||||
s->options.lpc_type = AV_LPC_TYPE_FIXED;
|
||||
} else if (avctx->use_lpc == 1) {
|
||||
s->options.lpc_type = AV_LPC_TYPE_LEVINSON;
|
||||
} else if (avctx->use_lpc > 1) {
|
||||
s->options.lpc_type = AV_LPC_TYPE_CHOLESKY;
|
||||
s->options.lpc_passes = avctx->use_lpc - 1;
|
||||
}
|
||||
#endif
|
||||
#if FF_API_FLAC_GLOBAL_OPTS
|
||||
if (avctx->lpc_type > FF_LPC_TYPE_DEFAULT) {
|
||||
if (avctx->lpc_type > FF_LPC_TYPE_CHOLESKY) {
|
||||
|
@@ -599,6 +599,10 @@ retry:
|
||||
s->current_picture.pict_type= s->pict_type;
|
||||
s->current_picture.key_frame= s->pict_type == AV_PICTURE_TYPE_I;
|
||||
|
||||
#if FF_API_HURRY_UP
|
||||
/* skip everything if we are in a hurry>=5 */
|
||||
if(avctx->hurry_up>=5) return get_consumed_bytes(s, buf_size);
|
||||
#endif
|
||||
if( (avctx->skip_frame >= AVDISCARD_NONREF && s->pict_type==AV_PICTURE_TYPE_B)
|
||||
||(avctx->skip_frame >= AVDISCARD_NONKEY && s->pict_type!=AV_PICTURE_TYPE_I)
|
||||
|| avctx->skip_frame >= AVDISCARD_ALL)
|
||||
|
@@ -598,10 +598,18 @@ retry:
|
||||
|
||||
/* skip B-frames if we don't have reference frames */
|
||||
if(s->last_picture_ptr==NULL && (s->pict_type==AV_PICTURE_TYPE_B || s->dropable)) return get_consumed_bytes(s, buf_size);
|
||||
#if FF_API_HURRY_UP
|
||||
/* skip b frames if we are in a hurry */
|
||||
if(avctx->hurry_up && s->pict_type==FF_B_TYPE) return get_consumed_bytes(s, buf_size);
|
||||
#endif
|
||||
if( (avctx->skip_frame >= AVDISCARD_NONREF && s->pict_type==AV_PICTURE_TYPE_B)
|
||||
|| (avctx->skip_frame >= AVDISCARD_NONKEY && s->pict_type!=AV_PICTURE_TYPE_I)
|
||||
|| avctx->skip_frame >= AVDISCARD_ALL)
|
||||
return get_consumed_bytes(s, buf_size);
|
||||
#if FF_API_HURRY_UP
|
||||
/* skip everything if we are in a hurry>=5 */
|
||||
if(avctx->hurry_up>=5) return get_consumed_bytes(s, buf_size);
|
||||
#endif
|
||||
|
||||
if(s->next_p_frame_damaged){
|
||||
if(s->pict_type==AV_PICTURE_TYPE_B)
|
||||
|
@@ -2810,11 +2810,9 @@ static int decode_slice_header(H264Context *h, H264Context *h0){
|
||||
s0->first_field = FIELD_PICTURE;
|
||||
|
||||
} else {
|
||||
if (h->nal_ref_idc &&
|
||||
s0->current_picture_ptr->reference &&
|
||||
s0->current_picture_ptr->frame_num != h->frame_num) {
|
||||
if (s0->current_picture_ptr->frame_num != h->frame_num) {
|
||||
/*
|
||||
* This and previous field were reference, but had
|
||||
* This and previous field had
|
||||
* different frame_nums. Consider this field first in
|
||||
* pair. Throw away previous field except for reference
|
||||
* purposes.
|
||||
@@ -3770,7 +3768,11 @@ static int decode_nal_units(H264Context *h, const uint8_t *buf, int buf_size){
|
||||
}
|
||||
|
||||
//FIXME do not discard SEI id
|
||||
if(avctx->skip_frame >= AVDISCARD_NONREF && h->nal_ref_idc == 0)
|
||||
if(
|
||||
#if FF_API_HURRY_UP
|
||||
(s->hurry_up == 1 && h->nal_ref_idc == 0) ||
|
||||
#endif
|
||||
(avctx->skip_frame >= AVDISCARD_NONREF && h->nal_ref_idc == 0))
|
||||
continue;
|
||||
|
||||
again:
|
||||
@@ -3807,6 +3809,9 @@ static int decode_nal_units(H264Context *h, const uint8_t *buf, int buf_size){
|
||||
}
|
||||
|
||||
if(hx->redundant_pic_count==0
|
||||
#if FF_API_HURRY_UP
|
||||
&& hx->s.hurry_up < 5
|
||||
#endif
|
||||
&& (avctx->skip_frame < AVDISCARD_NONREF || hx->nal_ref_idc)
|
||||
&& (avctx->skip_frame < AVDISCARD_BIDIR || hx->slice_type_nos!=AV_PICTURE_TYPE_B)
|
||||
&& (avctx->skip_frame < AVDISCARD_NONKEY || hx->slice_type_nos==AV_PICTURE_TYPE_I)
|
||||
@@ -3844,6 +3849,9 @@ static int decode_nal_units(H264Context *h, const uint8_t *buf, int buf_size){
|
||||
|
||||
if(hx->redundant_pic_count==0 && hx->intra_gb_ptr && hx->s.data_partitioning
|
||||
&& s->context_initialized
|
||||
#if FF_API_HURRY_UP
|
||||
&& s->hurry_up < 5
|
||||
#endif
|
||||
&& (avctx->skip_frame < AVDISCARD_NONREF || hx->nal_ref_idc)
|
||||
&& (avctx->skip_frame < AVDISCARD_BIDIR || hx->slice_type_nos!=AV_PICTURE_TYPE_B)
|
||||
&& (avctx->skip_frame < AVDISCARD_NONKEY || hx->slice_type_nos==AV_PICTURE_TYPE_I)
|
||||
@@ -3982,7 +3990,11 @@ static int decode_frame(AVCodecContext *avctx,
|
||||
}
|
||||
|
||||
if(!(s->flags2 & CODEC_FLAG2_CHUNKS) && !s->current_picture_ptr){
|
||||
if (avctx->skip_frame >= AVDISCARD_NONREF)
|
||||
if (avctx->skip_frame >= AVDISCARD_NONREF
|
||||
#if FF_API_HURRY_UP
|
||||
|| s->hurry_up
|
||||
#endif
|
||||
)
|
||||
return 0;
|
||||
av_log(avctx, AV_LOG_ERROR, "no frame!\n");
|
||||
return -1;
|
||||
|
@@ -1075,7 +1075,7 @@ static void fill_decode_caches(H264Context *h, int mb_type){
|
||||
AV_ZERO32(h->mv_cache [list][scan8[0] + 4 - 1*8]);
|
||||
h->ref_cache[list][scan8[0] + 4 - 1*8]= topright_type ? LIST_NOT_USED : PART_NOT_AVAILABLE;
|
||||
}
|
||||
if(h->ref_cache[list][scan8[0] + 4 - 1*8] < 0){
|
||||
if(h->ref_cache[list][scan8[0] + 2 - 1*8] < 0 || h->ref_cache[list][scan8[0] + 4 - 1*8] < 0){
|
||||
if(USES_LIST(topleft_type, list)){
|
||||
const int b_xy = h->mb2b_xy [topleft_xy] + 3 + h->b_stride + (h->topleft_partition & 2*h->b_stride);
|
||||
const int b8_xy= 4*topleft_xy + 1 + (h->topleft_partition & 2);
|
||||
|
@@ -253,6 +253,10 @@ static void pred_spatial_direct_motion(H264Context * const h, int *mb_type){
|
||||
mb_type_col[1] = h->ref_list[1][0].mb_type[mb_xy + s->mb_stride];
|
||||
b8_stride = 2+4*s->mb_stride;
|
||||
b4_stride *= 6;
|
||||
if(IS_INTERLACED(mb_type_col[0]) != IS_INTERLACED(mb_type_col[1])){
|
||||
mb_type_col[0] &= ~MB_TYPE_INTERLACED;
|
||||
mb_type_col[1] &= ~MB_TYPE_INTERLACED;
|
||||
}
|
||||
|
||||
sub_mb_type |= MB_TYPE_16x16|MB_TYPE_DIRECT2; /* B_SUB_8x8 */
|
||||
if( (mb_type_col[0] & MB_TYPE_16x16_OR_INTRA)
|
||||
|
@@ -342,6 +342,10 @@ int ff_h264_decode_seq_parameter_set(H264Context *h){
|
||||
|
||||
if(sps->profile_idc >= 100){ //high profile
|
||||
sps->chroma_format_idc= get_ue_golomb_31(&s->gb);
|
||||
if (sps->chroma_format_idc > 3U) {
|
||||
av_log(h->s.avctx, AV_LOG_ERROR, "chroma_format_idc %d is illegal\n", sps->chroma_format_idc);
|
||||
goto fail;
|
||||
}
|
||||
if(sps->chroma_format_idc == 3)
|
||||
sps->residual_color_transform_flag = get_bits1(&s->gb);
|
||||
sps->bit_depth_luma = get_ue_golomb(&s->gb) + 8;
|
||||
|
@@ -72,7 +72,6 @@ typedef struct IdcinContext {
|
||||
hnode huff_nodes[256][HUF_TOKENS*2];
|
||||
int num_huff_nodes[256];
|
||||
|
||||
uint32_t pal[256];
|
||||
} IdcinContext;
|
||||
|
||||
/*
|
||||
@@ -215,7 +214,7 @@ static int idcin_decode_frame(AVCodecContext *avctx,
|
||||
const uint8_t *buf = avpkt->data;
|
||||
int buf_size = avpkt->size;
|
||||
IdcinContext *s = avctx->priv_data;
|
||||
const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, NULL);
|
||||
AVPaletteControl *palette_control = avctx->palctrl;
|
||||
|
||||
s->buf = buf;
|
||||
s->size = buf_size;
|
||||
@@ -230,12 +229,13 @@ static int idcin_decode_frame(AVCodecContext *avctx,
|
||||
|
||||
idcin_decode_vlcs(s);
|
||||
|
||||
if (pal) {
|
||||
s->frame.palette_has_changed = 1;
|
||||
memcpy(s->pal, pal, AVPALETTE_SIZE);
|
||||
}
|
||||
/* make the palette available on the way out */
|
||||
memcpy(s->frame.data[1], s->pal, AVPALETTE_SIZE);
|
||||
memcpy(s->frame.data[1], palette_control->palette, PALETTE_COUNT * 4);
|
||||
/* If palette changed inform application*/
|
||||
if (palette_control->palette_changed) {
|
||||
palette_control->palette_changed = 0;
|
||||
s->frame.palette_has_changed = 1;
|
||||
}
|
||||
|
||||
*data_size = sizeof(AVFrame);
|
||||
*(AVFrame*)data = s->frame;
|
||||
|
@@ -424,11 +424,40 @@ const char *avcodec_get_pix_fmt_name(enum PixelFormat pix_fmt)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if LIBAVCODEC_VERSION_MAJOR < 53
|
||||
enum PixelFormat avcodec_get_pix_fmt(const char *name)
|
||||
{
|
||||
return av_get_pix_fmt(name);
|
||||
}
|
||||
|
||||
void avcodec_pix_fmt_string (char *buf, int buf_size, enum PixelFormat pix_fmt)
|
||||
{
|
||||
av_get_pix_fmt_string(buf, buf_size, pix_fmt);
|
||||
}
|
||||
#endif
|
||||
|
||||
int ff_is_hwaccel_pix_fmt(enum PixelFormat pix_fmt)
|
||||
{
|
||||
return av_pix_fmt_descriptors[pix_fmt].flags & PIX_FMT_HWACCEL;
|
||||
}
|
||||
|
||||
#if LIBAVCODEC_VERSION_MAJOR < 53
|
||||
int ff_set_systematic_pal(uint32_t pal[256], enum PixelFormat pix_fmt){
|
||||
return ff_set_systematic_pal2(pal, pix_fmt);
|
||||
}
|
||||
|
||||
int ff_fill_linesize(AVPicture *picture, enum PixelFormat pix_fmt, int width)
|
||||
{
|
||||
return av_image_fill_linesizes(picture->linesize, pix_fmt, width);
|
||||
}
|
||||
|
||||
int ff_fill_pointer(AVPicture *picture, uint8_t *ptr, enum PixelFormat pix_fmt,
|
||||
int height)
|
||||
{
|
||||
return av_image_fill_pointers(picture->data, pix_fmt, height, ptr, picture->linesize);
|
||||
}
|
||||
#endif
|
||||
|
||||
int avpicture_fill(AVPicture *picture, uint8_t *ptr,
|
||||
enum PixelFormat pix_fmt, int width, int height)
|
||||
{
|
||||
@@ -673,6 +702,28 @@ enum PixelFormat avcodec_find_best_pix_fmt(int64_t pix_fmt_mask, enum PixelForma
|
||||
return dst_pix_fmt;
|
||||
}
|
||||
|
||||
#if LIBAVCODEC_VERSION_MAJOR < 53
|
||||
void ff_img_copy_plane(uint8_t *dst, int dst_wrap,
|
||||
const uint8_t *src, int src_wrap,
|
||||
int width, int height)
|
||||
{
|
||||
av_image_copy_plane(dst, dst_wrap, src, src_wrap, width, height);
|
||||
}
|
||||
|
||||
int ff_get_plane_bytewidth(enum PixelFormat pix_fmt, int width, int plane)
|
||||
{
|
||||
return av_image_get_linesize(pix_fmt, width, plane);
|
||||
}
|
||||
|
||||
void av_picture_data_copy(uint8_t *dst_data[4], int dst_linesize[4],
|
||||
uint8_t *src_data[4], int src_linesize[4],
|
||||
enum PixelFormat pix_fmt, int width, int height)
|
||||
{
|
||||
av_image_copy(dst_data, dst_linesize, src_data, src_linesize,
|
||||
pix_fmt, width, height);
|
||||
}
|
||||
#endif
|
||||
|
||||
void av_picture_copy(AVPicture *dst, const AVPicture *src,
|
||||
enum PixelFormat pix_fmt, int width, int height)
|
||||
{
|
||||
|
@@ -69,7 +69,6 @@ typedef struct IpvideoContext {
|
||||
int stride;
|
||||
int upper_motion_limit_offset;
|
||||
|
||||
uint32_t pal[256];
|
||||
} IpvideoContext;
|
||||
|
||||
#define CHECK_STREAM_PTR(stream_ptr, stream_end, n) \
|
||||
@@ -962,7 +961,7 @@ static void ipvideo_decode_opcodes(IpvideoContext *s)
|
||||
|
||||
if (!s->is_16bpp) {
|
||||
/* this is PAL8, so make the palette available */
|
||||
memcpy(s->current_frame.data[1], s->pal, AVPALETTE_SIZE);
|
||||
memcpy(s->current_frame.data[1], s->avctx->palctrl->palette, PALETTE_COUNT * 4);
|
||||
|
||||
s->stride = s->current_frame.linesize[0];
|
||||
s->stream_ptr = s->buf + 14; /* data starts 14 bytes in */
|
||||
@@ -1016,6 +1015,10 @@ static av_cold int ipvideo_decode_init(AVCodecContext *avctx)
|
||||
|
||||
s->is_16bpp = avctx->bits_per_coded_sample == 16;
|
||||
avctx->pix_fmt = s->is_16bpp ? PIX_FMT_RGB555 : PIX_FMT_PAL8;
|
||||
if (!s->is_16bpp && s->avctx->palctrl == NULL) {
|
||||
av_log(avctx, AV_LOG_ERROR, " Interplay video: palette expected.\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
dsputil_init(&s->dsp, avctx);
|
||||
|
||||
@@ -1038,6 +1041,7 @@ static int ipvideo_decode_frame(AVCodecContext *avctx,
|
||||
const uint8_t *buf = avpkt->data;
|
||||
int buf_size = avpkt->size;
|
||||
IpvideoContext *s = avctx->priv_data;
|
||||
AVPaletteControl *palette_control = avctx->palctrl;
|
||||
|
||||
/* compressed buffer needs to be large enough to at least hold an entire
|
||||
* decoding map */
|
||||
@@ -1054,16 +1058,13 @@ static int ipvideo_decode_frame(AVCodecContext *avctx,
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!s->is_16bpp) {
|
||||
const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, NULL);
|
||||
if (pal) {
|
||||
s->current_frame.palette_has_changed = 1;
|
||||
memcpy(s->pal, pal, AVPALETTE_SIZE);
|
||||
}
|
||||
}
|
||||
|
||||
ipvideo_decode_opcodes(s);
|
||||
|
||||
if (!s->is_16bpp && palette_control->palette_changed) {
|
||||
palette_control->palette_changed = 0;
|
||||
s->current_frame.palette_has_changed = 1;
|
||||
}
|
||||
|
||||
*data_size = sizeof(AVFrame);
|
||||
*(AVFrame*)data = s->current_frame;
|
||||
|
||||
|
@@ -321,7 +321,7 @@ int ff_j2k_dwt_init(DWTContext *s, uint16_t border[2][2], int decomp_levels, int
|
||||
int i, j, lev = decomp_levels, maxlen,
|
||||
b[2][2];
|
||||
|
||||
if (decomp_levels >= FF_DWT_MAX_DECLVLS)
|
||||
if ((unsigned)decomp_levels >= FF_DWT_MAX_DECLVLS)
|
||||
return AVERROR_INVALIDDATA;
|
||||
s->ndeclevels = decomp_levels;
|
||||
s->type = type;
|
||||
|
@@ -359,7 +359,7 @@ static int get_qcx(J2kDecoderContext *s, int n, J2kQuantStyle *q)
|
||||
|
||||
if (q->quantsty == J2K_QSTY_NONE){
|
||||
n -= 3;
|
||||
if (s->buf_end - s->buf < n)
|
||||
if (s->buf_end - s->buf < n || 32*3 < n)
|
||||
return AVERROR(EINVAL);
|
||||
for (i = 0; i < n; i++)
|
||||
q->expn[i] = bytestream_get_byte(&s->buf) >> 3;
|
||||
@@ -376,7 +376,7 @@ static int get_qcx(J2kDecoderContext *s, int n, J2kQuantStyle *q)
|
||||
}
|
||||
} else{
|
||||
n = (n - 3) >> 1;
|
||||
if (s->buf_end - s->buf < n)
|
||||
if (s->buf_end - s->buf < n || 32*3 < n)
|
||||
return AVERROR(EINVAL);
|
||||
for (i = 0; i < n; i++){
|
||||
x = bytestream_get_be16(&s->buf);
|
||||
@@ -421,6 +421,10 @@ static uint8_t get_sot(J2kDecoderContext *s)
|
||||
return AVERROR(EINVAL);
|
||||
|
||||
s->curtileno = bytestream_get_be16(&s->buf); ///< Isot
|
||||
if((unsigned)s->curtileno >= s->numXtiles * s->numYtiles){
|
||||
s->curtileno=0;
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
|
||||
s->buf += 4; ///< Psot (ignored)
|
||||
|
||||
|
@@ -233,7 +233,6 @@ static int decode_frame(AVCodecContext * avctx, void *data, int *data_size, AVPa
|
||||
int i;
|
||||
int header;
|
||||
int blocksize;
|
||||
const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, NULL);
|
||||
|
||||
if (ctx->pic.data[0])
|
||||
avctx->release_buffer(avctx, &ctx->pic);
|
||||
@@ -265,6 +264,13 @@ static int decode_frame(AVCodecContext * avctx, void *data, int *data_size, AVPa
|
||||
ctx->pic.pict_type = AV_PICTURE_TYPE_P;
|
||||
}
|
||||
|
||||
/* if palette has been changed, copy it from palctrl */
|
||||
if (ctx->avctx->palctrl && ctx->avctx->palctrl->palette_changed) {
|
||||
memcpy(ctx->pal, ctx->avctx->palctrl->palette, AVPALETTE_SIZE);
|
||||
ctx->setpal = 1;
|
||||
ctx->avctx->palctrl->palette_changed = 0;
|
||||
}
|
||||
|
||||
if (header & KMVC_PALETTE) {
|
||||
ctx->pic.palette_has_changed = 1;
|
||||
// palette starts from index 1 and has 127 entries
|
||||
@@ -273,11 +279,6 @@ static int decode_frame(AVCodecContext * avctx, void *data, int *data_size, AVPa
|
||||
}
|
||||
}
|
||||
|
||||
if (pal) {
|
||||
ctx->pic.palette_has_changed = 1;
|
||||
memcpy(ctx->pal, pal, AVPALETTE_SIZE);
|
||||
}
|
||||
|
||||
if (ctx->setpal) {
|
||||
ctx->setpal = 0;
|
||||
ctx->pic.palette_has_changed = 1;
|
||||
@@ -373,6 +374,9 @@ static av_cold int decode_init(AVCodecContext * avctx)
|
||||
src += 4;
|
||||
}
|
||||
c->setpal = 1;
|
||||
if (c->avctx->palctrl) {
|
||||
c->avctx->palctrl->palette_changed = 0;
|
||||
}
|
||||
}
|
||||
|
||||
avcodec_get_frame_defaults(&c->pic);
|
||||
|
@@ -63,9 +63,7 @@ static av_cold int aacPlus_encode_init(AVCodecContext *avctx)
|
||||
|
||||
aacplus_cfg->bitRate = avctx->bit_rate;
|
||||
aacplus_cfg->bandWidth = avctx->cutoff;
|
||||
if (avctx->flags & CODEC_FLAG_GLOBAL_HEADER) {
|
||||
aacplus_cfg->outputFormat = 0; //raw aac
|
||||
}
|
||||
aacplus_cfg->outputFormat = !(avctx->flags & CODEC_FLAG_GLOBAL_HEADER);
|
||||
aacplus_cfg->inputFormat = AACPLUS_INPUT_16BIT;
|
||||
if (!aacplusEncSetConfiguration(s->aacplus_handle, aacplus_cfg)) {
|
||||
av_log(avctx, AV_LOG_ERROR, "libaacplus doesn't support this output format!\n");
|
||||
|
@@ -2475,10 +2475,18 @@ static int decode_chunks(AVCodecContext *avctx,
|
||||
/* Skip P-frames if we do not have a reference frame or we have an invalid header. */
|
||||
if(s2->pict_type==AV_PICTURE_TYPE_P && !s->sync) break;
|
||||
}
|
||||
#if FF_API_HURRY_UP
|
||||
/* Skip B-frames if we are in a hurry. */
|
||||
if(avctx->hurry_up && s2->pict_type==FF_B_TYPE) break;
|
||||
#endif
|
||||
if( (avctx->skip_frame >= AVDISCARD_NONREF && s2->pict_type==AV_PICTURE_TYPE_B)
|
||||
||(avctx->skip_frame >= AVDISCARD_NONKEY && s2->pict_type!=AV_PICTURE_TYPE_I)
|
||||
|| avctx->skip_frame >= AVDISCARD_ALL)
|
||||
break;
|
||||
#if FF_API_HURRY_UP
|
||||
/* Skip everything if we are in a hurry>=5. */
|
||||
if(avctx->hurry_up>=5) break;
|
||||
#endif
|
||||
|
||||
if (!s->mpeg_enc_ctx_allocated) break;
|
||||
|
||||
|
@@ -1139,6 +1139,9 @@ int MPV_frame_start(MpegEncContext *s, AVCodecContext *avctx)
|
||||
}
|
||||
}
|
||||
|
||||
#if FF_API_HURRY_UP
|
||||
s->hurry_up= s->avctx->hurry_up;
|
||||
#endif
|
||||
s->error_recognition= avctx->error_recognition;
|
||||
|
||||
/* set dequantizer, we can't do it during init as it might change for mpeg4
|
||||
@@ -2148,6 +2151,9 @@ void MPV_decode_mb_internal(MpegEncContext *s, DCTELEM block[12][64],
|
||||
}
|
||||
|
||||
/* skip dequant / idct if we are really late ;) */
|
||||
#if FF_API_HURRY_UP
|
||||
if(s->hurry_up>1) goto skip_idct;
|
||||
#endif
|
||||
if(s->avctx->skip_idct){
|
||||
if( (s->avctx->skip_idct >= AVDISCARD_NONREF && s->pict_type == AV_PICTURE_TYPE_B)
|
||||
||(s->avctx->skip_idct >= AVDISCARD_NONKEY && s->pict_type != AV_PICTURE_TYPE_I)
|
||||
|
@@ -392,6 +392,11 @@ typedef struct MpegEncContext {
|
||||
int no_rounding; /**< apply no rounding to motion compensation (MPEG4, msmpeg4, ...)
|
||||
for b-frames rounding mode is always 0 */
|
||||
|
||||
#if FF_API_HURRY_UP
|
||||
int hurry_up; /**< when set to 1 during decoding, b frames will be skipped
|
||||
when set to 2 idct/dequant will be skipped too */
|
||||
#endif
|
||||
|
||||
/* macroblock layer */
|
||||
int mb_x, mb_y;
|
||||
int mb_skip_run;
|
||||
|
@@ -725,7 +725,7 @@ static av_always_inline void MPV_motion_internal(MpegEncContext *s,
|
||||
0, 0, 0,
|
||||
ref_picture, pix_op, qpix_op,
|
||||
s->mv[dir][0][0], s->mv[dir][0][1], 16);
|
||||
}else if(!is_mpeg12 && (CONFIG_WMV2_DECODER || CONFIG_WMV2_ENCODER) && s->mspel){
|
||||
}else if(!is_mpeg12 && (CONFIG_WMV2_DECODER || CONFIG_WMV2_ENCODER) && s->mspel && s->codec_id == CODEC_ID_WMV2){
|
||||
ff_mspel_motion(s, dest_y, dest_cb, dest_cr,
|
||||
ref_picture, pix_op,
|
||||
s->mv[dir][0][0], s->mv[dir][0][1], 16);
|
||||
|
@@ -973,7 +973,7 @@ static int estimate_best_b_count(MpegEncContext *s){
|
||||
c->time_base= s->avctx->time_base;
|
||||
c->max_b_frames= s->max_b_frames;
|
||||
|
||||
if (avcodec_open(c, codec) < 0)
|
||||
if (avcodec_open2(c, codec, NULL) < 0)
|
||||
return -1;
|
||||
|
||||
for(i=0; i<s->max_b_frames+2; i++){
|
||||
|
@@ -26,6 +26,9 @@
|
||||
* http://www.pcisys.net/~melanson/codecs/
|
||||
*
|
||||
* The MS RLE decoder outputs PAL8 colorspace data.
|
||||
*
|
||||
* Note that this decoder expects the palette colors from the end of the
|
||||
* BITMAPINFO header passed through palctrl.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
@@ -43,7 +46,6 @@ typedef struct MsrleContext {
|
||||
const unsigned char *buf;
|
||||
int size;
|
||||
|
||||
uint32_t pal[256];
|
||||
} MsrleContext;
|
||||
|
||||
static av_cold int msrle_decode_init(AVCodecContext *avctx)
|
||||
@@ -93,16 +95,13 @@ static int msrle_decode_frame(AVCodecContext *avctx,
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (avctx->bits_per_coded_sample > 1 && avctx->bits_per_coded_sample <= 8) {
|
||||
const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, NULL);
|
||||
|
||||
if (pal) {
|
||||
s->frame.palette_has_changed = 1;
|
||||
memcpy(s->pal, pal, AVPALETTE_SIZE);
|
||||
}
|
||||
|
||||
if (s->avctx->palctrl) {
|
||||
/* make the palette available */
|
||||
memcpy(s->frame.data[1], s->pal, AVPALETTE_SIZE);
|
||||
memcpy(s->frame.data[1], s->avctx->palctrl->palette, AVPALETTE_SIZE);
|
||||
if (s->avctx->palctrl->palette_changed) {
|
||||
s->frame.palette_has_changed = 1;
|
||||
s->avctx->palctrl->palette_changed = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* FIXME how to correctly detect RLE ??? */
|
||||
|
@@ -25,6 +25,9 @@
|
||||
* For more information about the MS Video-1 format, visit:
|
||||
* http://www.pcisys.net/~melanson/codecs/
|
||||
*
|
||||
* This decoder outputs either PAL8 or RGB555 data, depending on the
|
||||
* whether a RGB palette was passed through palctrl;
|
||||
* if it's present, then the data is PAL8; RGB555 otherwise.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
@@ -52,7 +55,6 @@ typedef struct Msvideo1Context {
|
||||
|
||||
int mode_8bit; /* if it's not 8-bit, it's 16-bit */
|
||||
|
||||
uint32_t pal[256];
|
||||
} Msvideo1Context;
|
||||
|
||||
static av_cold int msvideo1_decode_init(AVCodecContext *avctx)
|
||||
@@ -62,7 +64,7 @@ static av_cold int msvideo1_decode_init(AVCodecContext *avctx)
|
||||
s->avctx = avctx;
|
||||
|
||||
/* figure out the colorspace based on the presence of a palette */
|
||||
if (s->avctx->bits_per_coded_sample == 8) {
|
||||
if (s->avctx->palctrl) {
|
||||
s->mode_8bit = 1;
|
||||
avctx->pix_fmt = PIX_FMT_PAL8;
|
||||
} else {
|
||||
@@ -172,8 +174,13 @@ static void msvideo1_decode_8bit(Msvideo1Context *s)
|
||||
}
|
||||
|
||||
/* make the palette available on the way out */
|
||||
if (s->avctx->pix_fmt == PIX_FMT_PAL8)
|
||||
memcpy(s->frame.data[1], s->pal, AVPALETTE_SIZE);
|
||||
if (s->avctx->pix_fmt == PIX_FMT_PAL8) {
|
||||
memcpy(s->frame.data[1], s->avctx->palctrl->palette, AVPALETTE_SIZE);
|
||||
if (s->avctx->palctrl->palette_changed) {
|
||||
s->frame.palette_has_changed = 1;
|
||||
s->avctx->palctrl->palette_changed = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void msvideo1_decode_16bit(Msvideo1Context *s)
|
||||
@@ -303,15 +310,6 @@ static int msvideo1_decode_frame(AVCodecContext *avctx,
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (s->mode_8bit) {
|
||||
const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, NULL);
|
||||
|
||||
if (pal) {
|
||||
memcpy(s->pal, pal, AVPALETTE_SIZE);
|
||||
s->frame.palette_has_changed = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (s->mode_8bit)
|
||||
msvideo1_decode_8bit(s);
|
||||
else
|
||||
|
@@ -20,6 +20,7 @@
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <limits.h>
|
||||
|
||||
#include "libavutil/bswap.h"
|
||||
#include "libavutil/lzo.h"
|
||||
@@ -112,19 +113,23 @@ static int codec_reinit(AVCodecContext *avctx, int width, int height, int qualit
|
||||
if (quality >= 0)
|
||||
get_quant_quality(c, quality);
|
||||
if (width != c->width || height != c->height) {
|
||||
if (av_image_check_size(height, width, 0, avctx) < 0)
|
||||
return 0;
|
||||
// also reserve space for a possible additional header
|
||||
int buf_size = 24 + height * width * 3 / 2 + AV_LZO_OUTPUT_PADDING;
|
||||
if (av_image_check_size(height, width, 0, avctx) < 0 ||
|
||||
buf_size > INT_MAX/8)
|
||||
return -1;
|
||||
avctx->width = c->width = width;
|
||||
avctx->height = c->height = height;
|
||||
av_fast_malloc(&c->decomp_buf, &c->decomp_size, c->height * c->width * 3 / 2);
|
||||
av_fast_malloc(&c->decomp_buf, &c->decomp_size, buf_size);
|
||||
if (!c->decomp_buf) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Can't allocate decompression buffer.\n");
|
||||
return 0;
|
||||
return AVERROR(ENOMEM);
|
||||
}
|
||||
rtjpeg_decode_init(&c->rtj, &c->dsp, c->width, c->height, c->lq, c->cq);
|
||||
return 1;
|
||||
} else if (quality != c->quality)
|
||||
rtjpeg_decode_init(&c->rtj, &c->dsp, c->width, c->height, c->lq, c->cq);
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int decode_frame(AVCodecContext *avctx, void *data, int *data_size,
|
||||
@@ -135,6 +140,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size,
|
||||
AVFrame *picture = data;
|
||||
int orig_size = buf_size;
|
||||
int keyframe;
|
||||
int size_change = 0;
|
||||
int result;
|
||||
enum {NUV_UNCOMPRESSED = '0', NUV_RTJPEG = '1',
|
||||
NUV_RTJPEG_IN_LZO = '2', NUV_LZO = '3',
|
||||
@@ -172,18 +178,19 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size,
|
||||
default:
|
||||
keyframe = 1; break;
|
||||
}
|
||||
retry:
|
||||
// skip rest of the frameheader.
|
||||
buf = &buf[12];
|
||||
buf_size -= 12;
|
||||
if (comptype == NUV_RTJPEG_IN_LZO || comptype == NUV_LZO) {
|
||||
int outlen = c->decomp_size, inlen = buf_size;
|
||||
int outlen = c->decomp_size - AV_LZO_OUTPUT_PADDING, inlen = buf_size;
|
||||
if (av_lzo1x_decode(c->decomp_buf, &outlen, buf, &inlen))
|
||||
av_log(avctx, AV_LOG_ERROR, "error during lzo decompression\n");
|
||||
buf = c->decomp_buf;
|
||||
buf_size = c->decomp_size;
|
||||
buf_size = c->decomp_size - AV_LZO_OUTPUT_PADDING;
|
||||
}
|
||||
if (c->codec_frameheader) {
|
||||
int w, h, q;
|
||||
int w, h, q, res;
|
||||
if (buf_size < 12) {
|
||||
av_log(avctx, AV_LOG_ERROR, "invalid nuv video frame\n");
|
||||
return -1;
|
||||
@@ -191,13 +198,20 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size,
|
||||
w = AV_RL16(&buf[6]);
|
||||
h = AV_RL16(&buf[8]);
|
||||
q = buf[10];
|
||||
if (!codec_reinit(avctx, w, h, q))
|
||||
return -1;
|
||||
res = codec_reinit(avctx, w, h, q);
|
||||
if (res < 0)
|
||||
return res;
|
||||
if (res) {
|
||||
buf = avpkt->data;
|
||||
buf_size = avpkt->size;
|
||||
size_change = 1;
|
||||
goto retry;
|
||||
}
|
||||
buf = &buf[12];
|
||||
buf_size -= 12;
|
||||
}
|
||||
|
||||
if (keyframe && c->pic.data[0])
|
||||
if ((size_change || keyframe) && c->pic.data[0])
|
||||
avctx->release_buffer(avctx, &c->pic);
|
||||
c->pic.reference = 3;
|
||||
c->pic.buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_READABLE |
|
||||
@@ -259,7 +273,7 @@ static av_cold int decode_init(AVCodecContext *avctx) {
|
||||
if (avctx->extradata_size)
|
||||
get_quant(avctx, c, avctx->extradata, avctx->extradata_size);
|
||||
dsputil_init(&c->dsp, avctx);
|
||||
if (!codec_reinit(avctx, avctx->width, avctx->height, -1))
|
||||
if (codec_reinit(avctx, avctx->width, avctx->height, -1) < 0)
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
89
libavcodec/opt.c
Normal file
89
libavcodec/opt.c
Normal file
@@ -0,0 +1,89 @@
|
||||
/*
|
||||
* AVOptions ABI compatibility wrapper
|
||||
* Copyright (c) 2010 Michael Niedermayer <michaelni@gmx.at>
|
||||
*
|
||||
* This file is part of Libav.
|
||||
*
|
||||
* Libav 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.
|
||||
*
|
||||
* Libav 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 Libav; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "avcodec.h"
|
||||
#include "opt.h"
|
||||
|
||||
#if LIBAVCODEC_VERSION_MAJOR < 53 && CONFIG_SHARED && HAVE_SYMVER
|
||||
|
||||
FF_SYMVER(const AVOption *, av_find_opt, (void *obj, const char *name, const char *unit, int mask, int flags), "LIBAVCODEC_52"){
|
||||
return av_find_opt(obj, name, unit, mask, flags);
|
||||
}
|
||||
FF_SYMVER(int, av_set_string3, (void *obj, const char *name, const char *val, int alloc, const AVOption **o_out), "LIBAVCODEC_52"){
|
||||
return av_set_string3(obj, name, val, alloc, o_out);
|
||||
}
|
||||
FF_SYMVER(const AVOption *, av_set_double, (void *obj, const char *name, double n), "LIBAVCODEC_52"){
|
||||
return av_set_double(obj, name, n);
|
||||
}
|
||||
FF_SYMVER(const AVOption *, av_set_q, (void *obj, const char *name, AVRational n), "LIBAVCODEC_52"){
|
||||
return av_set_q(obj, name, n);
|
||||
}
|
||||
FF_SYMVER(const AVOption *, av_set_int, (void *obj, const char *name, int64_t n), "LIBAVCODEC_52"){
|
||||
return av_set_int(obj, name, n);
|
||||
}
|
||||
FF_SYMVER(double, av_get_double, (void *obj, const char *name, const AVOption **o_out), "LIBAVCODEC_52"){
|
||||
return av_get_double(obj, name, o_out);
|
||||
}
|
||||
FF_SYMVER(AVRational, av_get_q, (void *obj, const char *name, const AVOption **o_out), "LIBAVCODEC_52"){
|
||||
return av_get_q(obj, name, o_out);
|
||||
}
|
||||
FF_SYMVER(int64_t, av_get_int, (void *obj, const char *name, const AVOption **o_out), "LIBAVCODEC_52"){
|
||||
return av_get_int(obj, name, o_out);
|
||||
}
|
||||
FF_SYMVER(const char *, av_get_string, (void *obj, const char *name, const AVOption **o_out, char *buf, int buf_len), "LIBAVCODEC_52"){
|
||||
return av_get_string(obj, name, o_out, buf, buf_len);
|
||||
}
|
||||
FF_SYMVER(const AVOption *, av_next_option, (void *obj, const AVOption *last), "LIBAVCODEC_52"){
|
||||
return av_next_option(obj, last);
|
||||
}
|
||||
FF_SYMVER(int, av_opt_show2, (void *obj, void *av_log_obj, int req_flags, int rej_flags), "LIBAVCODEC_52"){
|
||||
return av_opt_show2(obj, av_log_obj, req_flags, rej_flags);
|
||||
}
|
||||
FF_SYMVER(void, av_opt_set_defaults, (void *s), "LIBAVCODEC_52"){
|
||||
return av_opt_set_defaults(s);
|
||||
}
|
||||
FF_SYMVER(void, av_opt_set_defaults2, (void *s, int mask, int flags), "LIBAVCODEC_52"){
|
||||
return av_opt_set_defaults2(s, mask, flags);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if FF_API_SET_STRING_OLD
|
||||
const AVOption *av_set_string2(void *obj, const char *name, const char *val, int alloc){
|
||||
const AVOption *o;
|
||||
if (av_set_string3(obj, name, val, alloc, &o) < 0)
|
||||
return NULL;
|
||||
return o;
|
||||
}
|
||||
|
||||
const AVOption *av_set_string(void *obj, const char *name, const char *val){
|
||||
const AVOption *o;
|
||||
if (av_set_string3(obj, name, val, 0, &o) < 0)
|
||||
return NULL;
|
||||
return o;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if FF_API_OPT_SHOW
|
||||
int av_opt_show(void *obj, void *av_log_obj){
|
||||
return av_opt_show2(obj, av_log_obj,
|
||||
AV_OPT_FLAG_ENCODING_PARAM|AV_OPT_FLAG_DECODING_PARAM, 0);
|
||||
}
|
||||
#endif
|
@@ -1,18 +1,21 @@
|
||||
/*
|
||||
* This file is part of Libav.
|
||||
* AVOptions
|
||||
* copyright (c) 2005 Michael Niedermayer <michaelni@gmx.at>
|
||||
*
|
||||
* Libav is free software; you can redistribute it and/or
|
||||
* 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.
|
||||
*
|
||||
* Libav is distributed in the hope that it will be useful,
|
||||
* 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 Libav; if not, write to the Free Software
|
||||
* License along with FFmpeg; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
@@ -25,10 +28,34 @@
|
||||
#ifndef AVCODEC_OPT_H
|
||||
#define AVCODEC_OPT_H
|
||||
|
||||
#include "libavcodec/version.h"
|
||||
/**
|
||||
* @file
|
||||
* AVOptions
|
||||
*/
|
||||
|
||||
#if FF_API_OPT_H
|
||||
#include "libavutil/rational.h"
|
||||
#include "avcodec.h"
|
||||
#include "libavutil/opt.h"
|
||||
|
||||
#if FF_API_SET_STRING_OLD
|
||||
/**
|
||||
* @see av_set_string2()
|
||||
*/
|
||||
attribute_deprecated const AVOption *av_set_string(void *obj, const char *name, const char *val);
|
||||
|
||||
/**
|
||||
* @return a pointer to the AVOption corresponding to the field set or
|
||||
* NULL if no matching AVOption exists, or if the value val is not
|
||||
* valid
|
||||
* @see av_set_string3()
|
||||
*/
|
||||
attribute_deprecated const AVOption *av_set_string2(void *obj, const char *name, const char *val, int alloc);
|
||||
#endif
|
||||
#if FF_API_OPT_SHOW
|
||||
/**
|
||||
* @deprecated Use av_opt_show2() instead.
|
||||
*/
|
||||
attribute_deprecated int av_opt_show(void *obj, void *av_log_obj);
|
||||
#endif
|
||||
|
||||
#endif /* AVCODEC_OPT_H */
|
||||
|
@@ -438,6 +438,7 @@ static const AVOption options[]={
|
||||
{"crf_max", "in crf mode, prevents vbv from lowering quality beyond this point", OFFSET(crf_max), FF_OPT_TYPE_FLOAT, {.dbl = DEFAULT }, 0, 51, V|E},
|
||||
{"log_level_offset", "set the log level offset", OFFSET(log_level_offset), FF_OPT_TYPE_INT, {.dbl = 0 }, INT_MIN, INT_MAX },
|
||||
#if FF_API_FLAC_GLOBAL_OPTS
|
||||
{"use_lpc", "sets whether to use LPC mode (FLAC)", OFFSET(use_lpc), FF_OPT_TYPE_INT, {.dbl = -1 }, INT_MIN, INT_MAX, A|E},
|
||||
{"lpc_type", "deprecated, use flac-specific options", OFFSET(lpc_type), FF_OPT_TYPE_INT, {.dbl = AV_LPC_TYPE_DEFAULT }, AV_LPC_TYPE_DEFAULT, AV_LPC_TYPE_NB-1, A|E},
|
||||
{"none", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = AV_LPC_TYPE_NONE }, INT_MIN, INT_MAX, A|E, "lpc_type"},
|
||||
{"fixed", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = AV_LPC_TYPE_FIXED }, INT_MIN, INT_MAX, A|E, "lpc_type"},
|
||||
|
@@ -105,6 +105,43 @@ void ff_fetch_timestamp(AVCodecParserContext *s, int off, int remove){
|
||||
}
|
||||
}
|
||||
|
||||
#if LIBAVCODEC_VERSION_MAJOR < 53
|
||||
/**
|
||||
*
|
||||
* @param buf input
|
||||
* @param buf_size input length, to signal EOF, this should be 0 (so that the last frame can be output)
|
||||
* @param pts input presentation timestamp
|
||||
* @param dts input decoding timestamp
|
||||
* @param poutbuf will contain a pointer to the first byte of the output frame
|
||||
* @param poutbuf_size will contain the length of the output frame
|
||||
* @return the number of bytes of the input bitstream used
|
||||
*
|
||||
* Example:
|
||||
* @code
|
||||
* while(in_len){
|
||||
* len = av_parser_parse(myparser, AVCodecContext, &data, &size,
|
||||
* in_data, in_len,
|
||||
* pts, dts);
|
||||
* in_data += len;
|
||||
* in_len -= len;
|
||||
*
|
||||
* if(size)
|
||||
* decode_frame(data, size);
|
||||
* }
|
||||
* @endcode
|
||||
*
|
||||
* @deprecated Use av_parser_parse2() instead.
|
||||
*/
|
||||
int av_parser_parse(AVCodecParserContext *s,
|
||||
AVCodecContext *avctx,
|
||||
uint8_t **poutbuf, int *poutbuf_size,
|
||||
const uint8_t *buf, int buf_size,
|
||||
int64_t pts, int64_t dts)
|
||||
{
|
||||
return av_parser_parse2(s, avctx, poutbuf, poutbuf_size, buf, buf_size, pts, dts, AV_NOPTS_VALUE);
|
||||
}
|
||||
#endif
|
||||
|
||||
int av_parser_parse2(AVCodecParserContext *s,
|
||||
AVCodecContext *avctx,
|
||||
uint8_t **poutbuf, int *poutbuf_size,
|
||||
|
@@ -471,7 +471,8 @@ static int decode_frame(AVCodecContext *avctx,
|
||||
avctx->pix_fmt = PIX_FMT_MONOBLACK;
|
||||
} else if (s->color_type == PNG_COLOR_TYPE_PALETTE) {
|
||||
avctx->pix_fmt = PIX_FMT_PAL8;
|
||||
} else if (s->color_type == PNG_COLOR_TYPE_GRAY_ALPHA) {
|
||||
} else if (s->bit_depth == 8 &&
|
||||
s->color_type == PNG_COLOR_TYPE_GRAY_ALPHA) {
|
||||
avctx->pix_fmt = PIX_FMT_GRAY8A;
|
||||
} else {
|
||||
goto fail;
|
||||
|
@@ -383,6 +383,9 @@ static void update_context_from_user(AVCodecContext *dst, AVCodecContext *src)
|
||||
dst->release_buffer = src->release_buffer;
|
||||
|
||||
dst->opaque = src->opaque;
|
||||
#if FF_API_HURRY_UP
|
||||
dst->hurry_up = src->hurry_up;
|
||||
#endif
|
||||
dst->dsp_mask = src->dsp_mask;
|
||||
dst->debug = src->debug;
|
||||
dst->debug_mv = src->debug_mv;
|
||||
|
@@ -76,6 +76,7 @@ do { \
|
||||
#define SAMPLES_NEEDED_2(why) \
|
||||
av_log (NULL,AV_LOG_INFO,"This file triggers some missing code. Please contact the developers.\nPosition: %s\n",why);
|
||||
|
||||
#define QDM2_MAX_FRAME_SIZE 512
|
||||
|
||||
typedef int8_t sb_int8_array[2][30][64];
|
||||
|
||||
@@ -168,7 +169,7 @@ typedef struct {
|
||||
/// I/O data
|
||||
const uint8_t *compressed_data;
|
||||
int compressed_size;
|
||||
float output_buffer[1024];
|
||||
float output_buffer[QDM2_MAX_FRAME_SIZE * MPA_MAX_CHANNELS * 2];
|
||||
|
||||
/// Synthesis filter
|
||||
MPADSPContext mpadsp;
|
||||
@@ -1327,7 +1328,7 @@ static void qdm2_fft_decode_tones (QDM2Context *q, int duration, GetBitContext *
|
||||
local_int_10 = 1 << (q->group_order - duration - 1);
|
||||
offset = 1;
|
||||
|
||||
while (1) {
|
||||
while (get_bits_left(gb)>0) {
|
||||
if (q->superblocktype_2_3) {
|
||||
while ((n = qdm2_get_vlc(gb, &vlc_tab_fft_tone_offset[local_int_8], 1, 2)) < 2) {
|
||||
offset = 1;
|
||||
@@ -1822,7 +1823,8 @@ static av_cold int qdm2_decode_init(AVCodecContext *avctx)
|
||||
// something like max decodable tones
|
||||
s->group_order = av_log2(s->group_size) + 1;
|
||||
s->frame_size = s->group_size / 16; // 16 iterations per super block
|
||||
if (s->frame_size > FF_ARRAY_ELEMS(s->output_buffer) / 2)
|
||||
|
||||
if (s->frame_size > QDM2_MAX_FRAME_SIZE)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
s->sub_sampling = s->fft_order - 7;
|
||||
@@ -1893,6 +1895,9 @@ static int qdm2_decode (QDM2Context *q, const uint8_t *in, int16_t *out)
|
||||
int ch, i;
|
||||
const int frame_size = (q->frame_size * q->channels);
|
||||
|
||||
if((unsigned)frame_size > FF_ARRAY_ELEMS(q->output_buffer)/2)
|
||||
return -1;
|
||||
|
||||
/* select input buffer */
|
||||
q->compressed_data = in;
|
||||
q->compressed_size = q->checksum_size;
|
||||
|
@@ -260,7 +260,6 @@ static int decode_frame(AVCodecContext *avctx,
|
||||
AVFrame * ref= (AVFrame*)&a->ref;
|
||||
uint8_t* outdata;
|
||||
int delta;
|
||||
const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, NULL);
|
||||
|
||||
if(ref->data[0])
|
||||
avctx->release_buffer(avctx, ref);
|
||||
@@ -280,11 +279,11 @@ static int decode_frame(AVCodecContext *avctx,
|
||||
}
|
||||
|
||||
/* make the palette available on the way out */
|
||||
if (pal) {
|
||||
memcpy(a->pic.data[1], a->avctx->palctrl->palette, AVPALETTE_SIZE);
|
||||
if (a->avctx->palctrl->palette_changed) {
|
||||
a->pic.palette_has_changed = 1;
|
||||
memcpy(a->pal, pal, AVPALETTE_SIZE);
|
||||
a->avctx->palctrl->palette_changed = 0;
|
||||
}
|
||||
memcpy(a->pic.data[1], a->pal, AVPALETTE_SIZE);
|
||||
|
||||
*data_size = sizeof(AVFrame);
|
||||
*(AVFrame*)data = a->pic;
|
||||
@@ -295,6 +294,10 @@ static int decode_frame(AVCodecContext *avctx,
|
||||
static av_cold int decode_init(AVCodecContext *avctx){
|
||||
QpegContext * const a = avctx->priv_data;
|
||||
|
||||
if (!avctx->palctrl) {
|
||||
av_log(avctx, AV_LOG_FATAL, "Missing required palette via palctrl\n");
|
||||
return -1;
|
||||
}
|
||||
avcodec_get_frame_defaults(&a->pic);
|
||||
avcodec_get_frame_defaults(&a->ref);
|
||||
a->avctx = avctx;
|
||||
|
@@ -46,7 +46,6 @@ typedef struct QtrleContext {
|
||||
const unsigned char *buf;
|
||||
int size;
|
||||
|
||||
uint32_t pal[256];
|
||||
} QtrleContext;
|
||||
|
||||
#define CHECK_STREAM_PTR(n) \
|
||||
@@ -520,15 +519,12 @@ static int qtrle_decode_frame(AVCodecContext *avctx,
|
||||
}
|
||||
|
||||
if(has_palette) {
|
||||
const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, NULL);
|
||||
|
||||
if (pal) {
|
||||
s->frame.palette_has_changed = 1;
|
||||
memcpy(s->pal, pal, AVPALETTE_SIZE);
|
||||
}
|
||||
|
||||
/* make the palette available on the way out */
|
||||
memcpy(s->frame.data[1], s->pal, AVPALETTE_SIZE);
|
||||
memcpy(s->frame.data[1], s->avctx->palctrl->palette, AVPALETTE_SIZE);
|
||||
if (s->avctx->palctrl->palette_changed) {
|
||||
s->frame.palette_has_changed = 1;
|
||||
s->avctx->palctrl->palette_changed = 0;
|
||||
}
|
||||
}
|
||||
|
||||
done:
|
||||
|
@@ -184,13 +184,9 @@ static int raw_decode(AVCodecContext *avctx,
|
||||
(av_pix_fmt_descriptors[avctx->pix_fmt].flags & PIX_FMT_PAL))){
|
||||
frame->data[1]= context->palette;
|
||||
}
|
||||
if (avctx->pix_fmt == PIX_FMT_PAL8) {
|
||||
const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, NULL);
|
||||
|
||||
if (pal) {
|
||||
memcpy(frame->data[1], pal, AVPALETTE_SIZE);
|
||||
frame->palette_has_changed = 1;
|
||||
}
|
||||
if (avctx->palctrl && avctx->palctrl->palette_changed) {
|
||||
memcpy(frame->data[1], avctx->palctrl->palette, AVPALETTE_SIZE);
|
||||
avctx->palctrl->palette_changed = 0;
|
||||
}
|
||||
if(avctx->pix_fmt==PIX_FMT_BGR24 && ((frame->linesize[0]+3)&~3)*avctx->height <= buf_size)
|
||||
frame->linesize[0] = (frame->linesize[0]+3)&~3;
|
||||
|
@@ -275,6 +275,17 @@ ReSampleContext *av_audio_resample_init(int output_channels, int input_channels,
|
||||
return s;
|
||||
}
|
||||
|
||||
#if FF_API_AUDIO_OLD
|
||||
ReSampleContext *audio_resample_init(int output_channels, int input_channels,
|
||||
int output_rate, int input_rate)
|
||||
{
|
||||
return av_audio_resample_init(output_channels, input_channels,
|
||||
output_rate, input_rate,
|
||||
AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S16,
|
||||
TAPS, 10, 0, 0.8);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* resample audio. 'nb_samples' is the number of input samples */
|
||||
/* XXX: optimize it ! */
|
||||
int audio_resample(ReSampleContext *s, short *output, short *input, int nb_samples)
|
||||
|
@@ -1464,10 +1464,18 @@ int ff_rv34_decode_frame(AVCodecContext *avctx,
|
||||
}
|
||||
if((!s->last_picture_ptr || !s->last_picture_ptr->data[0]) && si.type == AV_PICTURE_TYPE_B)
|
||||
return -1;
|
||||
#if FF_API_HURRY_UP
|
||||
/* skip b frames if we are in a hurry */
|
||||
if(avctx->hurry_up && si.type==FF_B_TYPE) return buf_size;
|
||||
#endif
|
||||
if( (avctx->skip_frame >= AVDISCARD_NONREF && si.type==AV_PICTURE_TYPE_B)
|
||||
|| (avctx->skip_frame >= AVDISCARD_NONKEY && si.type!=AV_PICTURE_TYPE_I)
|
||||
|| avctx->skip_frame >= AVDISCARD_ALL)
|
||||
return avpkt->size;
|
||||
|| avctx->skip_frame >= AVDISCARD_ALL) return avpkt->size;
|
||||
#if FF_API_HURRY_UP
|
||||
/* skip everything if we are in a hurry>=5 */
|
||||
if(avctx->hurry_up>=5)
|
||||
return buf_size;
|
||||
#endif
|
||||
|
||||
for(i=0; i<slice_count; i++){
|
||||
int offset= get_slice_offset(avctx, slices_hdr, i);
|
||||
|
@@ -81,6 +81,7 @@ typedef struct ShortenContext {
|
||||
int channels;
|
||||
|
||||
int32_t *decoded[MAX_CHANNELS];
|
||||
int32_t *decoded_base[MAX_CHANNELS];
|
||||
int32_t *offset[MAX_CHANNELS];
|
||||
int *coeffs;
|
||||
uint8_t *bitstream;
|
||||
@@ -130,13 +131,13 @@ static int allocate_buffers(ShortenContext *s)
|
||||
return AVERROR(ENOMEM);
|
||||
s->offset[chan] = tmp_ptr;
|
||||
|
||||
tmp_ptr = av_realloc(s->decoded[chan], sizeof(int32_t)*(s->blocksize + s->nwrap));
|
||||
tmp_ptr = av_realloc(s->decoded_base[chan], sizeof(int32_t)*(s->blocksize + s->nwrap));
|
||||
if (!tmp_ptr)
|
||||
return AVERROR(ENOMEM);
|
||||
s->decoded[chan] = tmp_ptr;
|
||||
s->decoded_base[chan] = tmp_ptr;
|
||||
for (i=0; i<s->nwrap; i++)
|
||||
s->decoded[chan][i] = 0;
|
||||
s->decoded[chan] += s->nwrap;
|
||||
s->decoded_base[chan][i] = 0;
|
||||
s->decoded[chan] = s->decoded_base[chan] + s->nwrap;
|
||||
}
|
||||
|
||||
coeffs = av_realloc(s->coeffs, s->nwrap * sizeof(*s->coeffs));
|
||||
@@ -548,8 +549,8 @@ static av_cold int shorten_decode_close(AVCodecContext *avctx)
|
||||
int i;
|
||||
|
||||
for (i = 0; i < s->channels; i++) {
|
||||
s->decoded[i] -= s->nwrap;
|
||||
av_freep(&s->decoded[i]);
|
||||
s->decoded[i] = NULL;
|
||||
av_freep(&s->decoded_base[i]);
|
||||
av_freep(&s->offset[i]);
|
||||
}
|
||||
av_freep(&s->bitstream);
|
||||
|
@@ -54,7 +54,6 @@ typedef struct SmcContext {
|
||||
unsigned char color_quads[COLORS_PER_TABLE * CQUAD];
|
||||
unsigned char color_octets[COLORS_PER_TABLE * COCTET];
|
||||
|
||||
uint32_t pal[256];
|
||||
} SmcContext;
|
||||
|
||||
#define GET_BLOCK_COUNT() \
|
||||
@@ -111,7 +110,11 @@ static void smc_decode_stream(SmcContext *s)
|
||||
int color_octet_index = 0;
|
||||
|
||||
/* make the palette available */
|
||||
memcpy(s->frame.data[1], s->pal, AVPALETTE_SIZE);
|
||||
memcpy(s->frame.data[1], s->avctx->palctrl->palette, AVPALETTE_SIZE);
|
||||
if (s->avctx->palctrl->palette_changed) {
|
||||
s->frame.palette_has_changed = 1;
|
||||
s->avctx->palctrl->palette_changed = 0;
|
||||
}
|
||||
|
||||
chunk_size = AV_RB32(&s->buf[stream_ptr]) & 0x00FFFFFF;
|
||||
stream_ptr += 4;
|
||||
@@ -438,7 +441,6 @@ static int smc_decode_frame(AVCodecContext *avctx,
|
||||
const uint8_t *buf = avpkt->data;
|
||||
int buf_size = avpkt->size;
|
||||
SmcContext *s = avctx->priv_data;
|
||||
const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, NULL);
|
||||
|
||||
s->buf = buf;
|
||||
s->size = buf_size;
|
||||
@@ -451,11 +453,6 @@ static int smc_decode_frame(AVCodecContext *avctx,
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (pal) {
|
||||
s->frame.palette_has_changed = 1;
|
||||
memcpy(s->pal, pal, AVPALETTE_SIZE);
|
||||
}
|
||||
|
||||
smc_decode_stream(s);
|
||||
|
||||
*data_size = sizeof(AVFrame);
|
||||
|
@@ -658,11 +658,15 @@ static int svq1_decode_frame(AVCodecContext *avctx,
|
||||
av_dlog(s->avctx, "Error in svq1_decode_frame_header %i\n",result);
|
||||
return result;
|
||||
}
|
||||
avcodec_set_dimensions(avctx, s->width, s->height);
|
||||
|
||||
//FIXME this avoids some confusion for "B frames" without 2 references
|
||||
//this should be removed after libavcodec can handle more flexible picture types & ordering
|
||||
if(s->pict_type==AV_PICTURE_TYPE_B && s->last_picture_ptr==NULL) return buf_size;
|
||||
|
||||
#if FF_API_HURRY_UP
|
||||
if(avctx->hurry_up && s->pict_type==FF_B_TYPE) return buf_size;
|
||||
#endif
|
||||
if( (avctx->skip_frame >= AVDISCARD_NONREF && s->pict_type==AV_PICTURE_TYPE_B)
|
||||
||(avctx->skip_frame >= AVDISCARD_NONKEY && s->pict_type!=AV_PICTURE_TYPE_I)
|
||||
|| avctx->skip_frame >= AVDISCARD_ALL)
|
||||
|
@@ -986,6 +986,14 @@ static int svq3_decode_frame(AVCodecContext *avctx,
|
||||
/* Skip B-frames if we do not have reference frames. */
|
||||
if (s->last_picture_ptr == NULL && s->pict_type == AV_PICTURE_TYPE_B)
|
||||
return 0;
|
||||
#if FF_API_HURRY_UP
|
||||
/* Skip B-frames if we are in a hurry. */
|
||||
if (avctx->hurry_up && s->pict_type == FF_B_TYPE)
|
||||
return 0;
|
||||
/* Skip everything if we are in a hurry >= 5. */
|
||||
if (avctx->hurry_up >= 5)
|
||||
return 0;
|
||||
#endif
|
||||
if ( (avctx->skip_frame >= AVDISCARD_NONREF && s->pict_type == AV_PICTURE_TYPE_B)
|
||||
||(avctx->skip_frame >= AVDISCARD_NONKEY && s->pict_type != AV_PICTURE_TYPE_I)
|
||||
|| avctx->skip_frame >= AVDISCARD_ALL)
|
||||
|
@@ -171,6 +171,13 @@ static int decode_frame(AVCodecContext *avctx,
|
||||
stride = -p->linesize[0];
|
||||
}
|
||||
|
||||
if(avctx->pix_fmt == PIX_FMT_PAL8 && avctx->palctrl){
|
||||
memcpy(p->data[1], avctx->palctrl->palette, AVPALETTE_SIZE);
|
||||
if(avctx->palctrl->palette_changed){
|
||||
p->palette_has_changed = 1;
|
||||
avctx->palctrl->palette_changed = 0;
|
||||
}
|
||||
}
|
||||
if(colors){
|
||||
size_t pal_size;
|
||||
if((colors + first_clr) > 256){
|
||||
|
@@ -60,8 +60,6 @@ typedef struct TsccContext {
|
||||
unsigned char* decomp_buf;
|
||||
int height;
|
||||
z_stream zstream;
|
||||
|
||||
uint32_t pal[256];
|
||||
} CamtasiaContext;
|
||||
|
||||
/*
|
||||
@@ -110,13 +108,11 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac
|
||||
|
||||
/* make the palette available on the way out */
|
||||
if (c->avctx->pix_fmt == PIX_FMT_PAL8) {
|
||||
const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, NULL);
|
||||
|
||||
if (pal) {
|
||||
memcpy(c->pic.data[1], c->avctx->palctrl->palette, AVPALETTE_SIZE);
|
||||
if (c->avctx->palctrl->palette_changed) {
|
||||
c->pic.palette_has_changed = 1;
|
||||
memcpy(c->pal, pal, AVPALETTE_SIZE);
|
||||
c->avctx->palctrl->palette_changed = 0;
|
||||
}
|
||||
memcpy(c->pic.data[1], c->pal, AVPALETTE_SIZE);
|
||||
}
|
||||
|
||||
*data_size = sizeof(AVFrame);
|
||||
|
@@ -32,6 +32,7 @@
|
||||
#include "libavutil/audioconvert.h"
|
||||
#include "libavutil/imgutils.h"
|
||||
#include "libavutil/samplefmt.h"
|
||||
#include "libavutil/dict.h"
|
||||
#include "avcodec.h"
|
||||
#include "dsputil.h"
|
||||
#include "libavutil/opt.h"
|
||||
@@ -48,7 +49,7 @@ static int volatile entangled_thread_counter=0;
|
||||
static int (*ff_lockmgr_cb)(void **mutex, enum AVLockOp op);
|
||||
static void *codec_mutex;
|
||||
|
||||
void *av_fast_realloc(void *ptr, unsigned int *size, size_t min_size)
|
||||
void *av_fast_realloc(void *ptr, unsigned int *size, FF_INTERNALC_MEM_TYPE min_size)
|
||||
{
|
||||
if(min_size < *size)
|
||||
return ptr;
|
||||
@@ -64,7 +65,7 @@ void *av_fast_realloc(void *ptr, unsigned int *size, size_t min_size)
|
||||
return ptr;
|
||||
}
|
||||
|
||||
void av_fast_malloc(void *ptr, unsigned int *size, size_t min_size)
|
||||
void av_fast_malloc(void *ptr, unsigned int *size, FF_INTERNALC_MEM_TYPE min_size)
|
||||
{
|
||||
void **p = ptr;
|
||||
if (min_size < *size)
|
||||
@@ -94,6 +95,13 @@ void avcodec_register(AVCodec *codec)
|
||||
codec->next = NULL;
|
||||
}
|
||||
|
||||
#if LIBAVCODEC_VERSION_MAJOR < 53
|
||||
void register_avcodec(AVCodec *codec)
|
||||
{
|
||||
avcodec_register(codec);
|
||||
}
|
||||
#endif
|
||||
|
||||
unsigned avcodec_get_edge_width(void)
|
||||
{
|
||||
return EDGE_WIDTH;
|
||||
@@ -223,6 +231,12 @@ void avcodec_align_dimensions(AVCodecContext *s, int *width, int *height){
|
||||
*width=FFALIGN(*width, align);
|
||||
}
|
||||
|
||||
#if LIBAVCODEC_VERSION_MAJOR < 53
|
||||
int avcodec_check_dimensions(void *av_log_ctx, unsigned int w, unsigned int h){
|
||||
return av_image_check_size(w, h, 0, av_log_ctx);
|
||||
}
|
||||
#endif
|
||||
|
||||
int avcodec_default_get_buffer(AVCodecContext *s, AVFrame *pic){
|
||||
int i;
|
||||
int w= s->width;
|
||||
@@ -485,9 +499,20 @@ static void avcodec_get_subtitle_defaults(AVSubtitle *sub)
|
||||
sub->pts = AV_NOPTS_VALUE;
|
||||
}
|
||||
|
||||
#if FF_API_AVCODEC_OPEN
|
||||
int attribute_align_arg avcodec_open(AVCodecContext *avctx, AVCodec *codec)
|
||||
{
|
||||
return avcodec_open2(avctx, codec, NULL);
|
||||
}
|
||||
#endif
|
||||
|
||||
int attribute_align_arg avcodec_open2(AVCodecContext *avctx, AVCodec *codec, AVDictionary **options)
|
||||
{
|
||||
int ret = 0;
|
||||
AVDictionary *tmp = NULL;
|
||||
|
||||
if (options)
|
||||
av_dict_copy(&tmp, *options, 0);
|
||||
|
||||
/* If there is a user-supplied mutex locking routine, call it. */
|
||||
if (ff_lockmgr_cb) {
|
||||
@@ -514,14 +539,18 @@ int attribute_align_arg avcodec_open(AVCodecContext *avctx, AVCodec *codec)
|
||||
ret = AVERROR(ENOMEM);
|
||||
goto end;
|
||||
}
|
||||
if(codec->priv_class){ //this can be droped once all user apps use avcodec_get_context_defaults3()
|
||||
if (codec->priv_class) {
|
||||
*(AVClass**)avctx->priv_data= codec->priv_class;
|
||||
av_opt_set_defaults(avctx->priv_data);
|
||||
}
|
||||
}
|
||||
if (codec->priv_class && (ret = av_opt_set_dict(avctx->priv_data, &tmp)) < 0)
|
||||
goto free_and_end;
|
||||
} else {
|
||||
avctx->priv_data = NULL;
|
||||
}
|
||||
if ((ret = av_opt_set_dict(avctx, &tmp)) < 0)
|
||||
goto free_and_end;
|
||||
|
||||
if(avctx->coded_width && avctx->coded_height)
|
||||
avcodec_set_dimensions(avctx, avctx->coded_width, avctx->coded_height);
|
||||
@@ -576,6 +605,8 @@ int attribute_align_arg avcodec_open(AVCodecContext *avctx, AVCodec *codec)
|
||||
if (avctx->codec->encode) {
|
||||
int i;
|
||||
if (avctx->codec->sample_fmts) {
|
||||
if (avctx->sample_fmt == AV_SAMPLE_FMT_NONE)
|
||||
avctx->sample_fmt = AV_SAMPLE_FMT_S16;
|
||||
for (i = 0; avctx->codec->sample_fmts[i] != AV_SAMPLE_FMT_NONE; i++)
|
||||
if (avctx->sample_fmt == avctx->codec->sample_fmts[i])
|
||||
break;
|
||||
@@ -640,8 +671,14 @@ end:
|
||||
if (ff_lockmgr_cb) {
|
||||
(*ff_lockmgr_cb)(&codec_mutex, AV_LOCK_RELEASE);
|
||||
}
|
||||
if (options) {
|
||||
av_dict_free(options);
|
||||
*options = tmp;
|
||||
}
|
||||
|
||||
return ret;
|
||||
free_and_end:
|
||||
av_dict_free(&tmp);
|
||||
av_freep(&avctx->priv_data);
|
||||
avctx->codec= NULL;
|
||||
goto end;
|
||||
@@ -727,6 +764,22 @@ static int64_t guess_correct_pts(AVCodecContext *ctx,
|
||||
return pts;
|
||||
}
|
||||
|
||||
#if FF_API_VIDEO_OLD
|
||||
int attribute_align_arg avcodec_decode_video(AVCodecContext *avctx, AVFrame *picture,
|
||||
int *got_picture_ptr,
|
||||
const uint8_t *buf, int buf_size)
|
||||
{
|
||||
AVPacket avpkt;
|
||||
av_init_packet(&avpkt);
|
||||
avpkt.data = buf;
|
||||
avpkt.size = buf_size;
|
||||
// HACK for CorePNG to decode as normal PNG by default
|
||||
avpkt.flags = AV_PKT_FLAG_KEY;
|
||||
|
||||
return avcodec_decode_video2(avctx, picture, got_picture_ptr, &avpkt);
|
||||
}
|
||||
#endif
|
||||
|
||||
int attribute_align_arg avcodec_decode_video2(AVCodecContext *avctx, AVFrame *picture,
|
||||
int *got_picture_ptr,
|
||||
AVPacket *avpkt)
|
||||
@@ -738,7 +791,6 @@ int attribute_align_arg avcodec_decode_video2(AVCodecContext *avctx, AVFrame *pi
|
||||
return -1;
|
||||
|
||||
if((avctx->codec->capabilities & CODEC_CAP_DELAY) || avpkt->size || (avctx->active_thread_type&FF_THREAD_FRAME)){
|
||||
av_packet_split_side_data(avpkt);
|
||||
avctx->pkt = avpkt;
|
||||
if (HAVE_PTHREADS && avctx->active_thread_type&FF_THREAD_FRAME)
|
||||
ret = ff_thread_decode_frame(avctx, picture, got_picture_ptr,
|
||||
@@ -777,6 +829,20 @@ int attribute_align_arg avcodec_decode_video2(AVCodecContext *avctx, AVFrame *pi
|
||||
return ret;
|
||||
}
|
||||
|
||||
#if FF_API_AUDIO_OLD
|
||||
int attribute_align_arg avcodec_decode_audio2(AVCodecContext *avctx, int16_t *samples,
|
||||
int *frame_size_ptr,
|
||||
const uint8_t *buf, int buf_size)
|
||||
{
|
||||
AVPacket avpkt;
|
||||
av_init_packet(&avpkt);
|
||||
avpkt.data = buf;
|
||||
avpkt.size = buf_size;
|
||||
|
||||
return avcodec_decode_audio3(avctx, samples, frame_size_ptr, &avpkt);
|
||||
}
|
||||
#endif
|
||||
|
||||
int attribute_align_arg avcodec_decode_audio3(AVCodecContext *avctx, int16_t *samples,
|
||||
int *frame_size_ptr,
|
||||
AVPacket *avpkt)
|
||||
@@ -811,6 +877,20 @@ int attribute_align_arg avcodec_decode_audio3(AVCodecContext *avctx, int16_t *sa
|
||||
return ret;
|
||||
}
|
||||
|
||||
#if FF_API_SUBTITLE_OLD
|
||||
int avcodec_decode_subtitle(AVCodecContext *avctx, AVSubtitle *sub,
|
||||
int *got_sub_ptr,
|
||||
const uint8_t *buf, int buf_size)
|
||||
{
|
||||
AVPacket avpkt;
|
||||
av_init_packet(&avpkt);
|
||||
avpkt.data = buf;
|
||||
avpkt.size = buf_size;
|
||||
|
||||
return avcodec_decode_subtitle2(avctx, sub, got_sub_ptr, &avpkt);
|
||||
}
|
||||
#endif
|
||||
|
||||
int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub,
|
||||
int *got_sub_ptr,
|
||||
AVPacket *avpkt)
|
||||
@@ -1243,6 +1323,20 @@ unsigned int av_xiphlacing(unsigned char *s, unsigned int v)
|
||||
return n;
|
||||
}
|
||||
|
||||
#if LIBAVCODEC_VERSION_MAJOR < 53
|
||||
#include "libavutil/parseutils.h"
|
||||
|
||||
int av_parse_video_frame_size(int *width_ptr, int *height_ptr, const char *str)
|
||||
{
|
||||
return av_parse_video_size(width_ptr, height_ptr, str);
|
||||
}
|
||||
|
||||
int av_parse_video_frame_rate(AVRational *frame_rate, const char *arg)
|
||||
{
|
||||
return av_parse_video_rate(frame_rate, arg);
|
||||
}
|
||||
#endif
|
||||
|
||||
int ff_match_2uint16(const uint16_t (*tab)[2], int size, int a, int b){
|
||||
int i;
|
||||
for(i=0; i<size && !(tab[i][0]==a && tab[i][1]==b); i++);
|
||||
@@ -1359,4 +1453,12 @@ int avcodec_thread_init(AVCodecContext *s, int thread_count)
|
||||
s->thread_count = thread_count;
|
||||
return ff_thread_init(s);
|
||||
}
|
||||
|
||||
void avcodec_thread_free(AVCodecContext *s)
|
||||
{
|
||||
#if HAVE_THREADS
|
||||
ff_thread_free(s);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@@ -3716,11 +3716,21 @@ static int vc1_decode_frame(AVCodecContext *avctx,
|
||||
if(s->last_picture_ptr==NULL && (s->pict_type==AV_PICTURE_TYPE_B || s->dropable)){
|
||||
goto err;
|
||||
}
|
||||
#if FF_API_HURRY_UP
|
||||
/* skip b frames if we are in a hurry */
|
||||
if(avctx->hurry_up && s->pict_type==FF_B_TYPE) return -1;//buf_size;
|
||||
#endif
|
||||
if( (avctx->skip_frame >= AVDISCARD_NONREF && s->pict_type==AV_PICTURE_TYPE_B)
|
||||
|| (avctx->skip_frame >= AVDISCARD_NONKEY && s->pict_type!=AV_PICTURE_TYPE_I)
|
||||
|| avctx->skip_frame >= AVDISCARD_ALL) {
|
||||
goto end;
|
||||
}
|
||||
#if FF_API_HURRY_UP
|
||||
/* skip everything if we are in a hurry>=5 */
|
||||
if(avctx->hurry_up>=5) {
|
||||
goto err;
|
||||
}
|
||||
#endif
|
||||
|
||||
if(s->next_p_frame_damaged){
|
||||
if(s->pict_type==AV_PICTURE_TYPE_B)
|
||||
|
@@ -67,13 +67,6 @@ struct vdpau_render_state {
|
||||
|
||||
int state; ///< Holds FF_VDPAU_STATE_* values.
|
||||
|
||||
/** Describe size/location of the compressed video data.
|
||||
Set to 0 when freeing bitstream_buffers. */
|
||||
int bitstream_buffers_allocated;
|
||||
int bitstream_buffers_used;
|
||||
/** The user is responsible for freeing this buffer using av_freep(). */
|
||||
VdpBitstreamBuffer *bitstream_buffers;
|
||||
|
||||
/** picture parameter information for all supported codecs */
|
||||
union VdpPictureInfo {
|
||||
VdpPictureInfoH264 h264;
|
||||
@@ -81,6 +74,13 @@ struct vdpau_render_state {
|
||||
VdpPictureInfoVC1 vc1;
|
||||
VdpPictureInfoMPEG4Part2 mpeg4;
|
||||
} info;
|
||||
|
||||
/** Describe size/location of the compressed video data.
|
||||
Set to 0 when freeing bitstream_buffers. */
|
||||
int bitstream_buffers_allocated;
|
||||
int bitstream_buffers_used;
|
||||
/** The user is responsible for freeing this buffer using av_freep(). */
|
||||
VdpBitstreamBuffer *bitstream_buffers;
|
||||
};
|
||||
|
||||
/* @}*/
|
||||
|
@@ -20,8 +20,8 @@
|
||||
#ifndef AVCODEC_VERSION_H
|
||||
#define AVCODEC_VERSION_H
|
||||
|
||||
#define LIBAVCODEC_VERSION_MAJOR 53
|
||||
#define LIBAVCODEC_VERSION_MINOR 7
|
||||
#define LIBAVCODEC_VERSION_MAJOR 52
|
||||
#define LIBAVCODEC_VERSION_MINOR 123
|
||||
#define LIBAVCODEC_VERSION_MICRO 0
|
||||
|
||||
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
|
||||
@@ -41,12 +41,45 @@
|
||||
#ifndef FF_API_PALETTE_CONTROL
|
||||
#define FF_API_PALETTE_CONTROL (LIBAVCODEC_VERSION_MAJOR < 54)
|
||||
#endif
|
||||
#ifndef FF_API_MM_FLAGS
|
||||
#define FF_API_MM_FLAGS (LIBAVCODEC_VERSION_MAJOR < 53)
|
||||
#endif
|
||||
#ifndef FF_API_OPT_SHOW
|
||||
#define FF_API_OPT_SHOW (LIBAVCODEC_VERSION_MAJOR < 53)
|
||||
#endif
|
||||
#ifndef FF_API_AUDIO_OLD
|
||||
#define FF_API_AUDIO_OLD (LIBAVCODEC_VERSION_MAJOR < 53)
|
||||
#endif
|
||||
#ifndef FF_API_VIDEO_OLD
|
||||
#define FF_API_VIDEO_OLD (LIBAVCODEC_VERSION_MAJOR < 53)
|
||||
#endif
|
||||
#ifndef FF_API_SUBTITLE_OLD
|
||||
#define FF_API_SUBTITLE_OLD (LIBAVCODEC_VERSION_MAJOR < 53)
|
||||
#endif
|
||||
#ifndef FF_API_USE_LPC
|
||||
#define FF_API_USE_LPC (LIBAVCODEC_VERSION_MAJOR < 53)
|
||||
#endif
|
||||
#ifndef FF_API_SET_STRING_OLD
|
||||
#define FF_API_SET_STRING_OLD (LIBAVCODEC_VERSION_MAJOR < 53)
|
||||
#endif
|
||||
#ifndef FF_API_INOFFICIAL
|
||||
#define FF_API_INOFFICIAL (LIBAVCODEC_VERSION_MAJOR < 53)
|
||||
#endif
|
||||
#ifndef FF_API_OLD_SAMPLE_FMT
|
||||
#define FF_API_OLD_SAMPLE_FMT (LIBAVCODEC_VERSION_MAJOR < 54)
|
||||
#endif
|
||||
#ifndef FF_API_OLD_AUDIOCONVERT
|
||||
#define FF_API_OLD_AUDIOCONVERT (LIBAVCODEC_VERSION_MAJOR < 54)
|
||||
#endif
|
||||
#ifndef FF_API_HURRY_UP
|
||||
#define FF_API_HURRY_UP (LIBAVCODEC_VERSION_MAJOR < 53)
|
||||
#endif
|
||||
#ifndef FF_API_RATE_EMU
|
||||
#define FF_API_RATE_EMU (LIBAVCODEC_VERSION_MAJOR < 53)
|
||||
#endif
|
||||
#ifndef FF_API_MB_Q
|
||||
#define FF_API_MB_Q (LIBAVCODEC_VERSION_MAJOR < 53)
|
||||
#endif
|
||||
#ifndef FF_API_ANTIALIAS_ALGO
|
||||
#define FF_API_ANTIALIAS_ALGO (LIBAVCODEC_VERSION_MAJOR < 54)
|
||||
#endif
|
||||
@@ -68,5 +101,8 @@
|
||||
#ifndef FF_API_GET_PIX_FMT_NAME
|
||||
#define FF_API_GET_PIX_FMT_NAME (LIBAVCODEC_VERSION_MAJOR < 54)
|
||||
#endif
|
||||
#ifndef FF_API_AVCODEC_OPEN
|
||||
#define FF_API_AVCODEC_OPEN (LIBAVCODEC_VERSION_MAJOR < 54)
|
||||
#endif
|
||||
|
||||
#endif /* AVCODEC_VERSION_H */
|
||||
|
@@ -150,7 +150,7 @@ void ff_vorbis_ready_floor1_list(vorbis_floor1_entry * list, int values)
|
||||
}
|
||||
}
|
||||
|
||||
static inline void render_line_unrolled(intptr_t x, intptr_t y, int x1,
|
||||
static inline void render_line_unrolled(intptr_t x, uint8_t y, int x1,
|
||||
intptr_t sy, int ady, int adx,
|
||||
float *buf)
|
||||
{
|
||||
@@ -173,7 +173,7 @@ static inline void render_line_unrolled(intptr_t x, intptr_t y, int x1,
|
||||
}
|
||||
}
|
||||
|
||||
static void render_line(int x0, int y0, int x1, int y1, float *buf)
|
||||
static void render_line(int x0, uint8_t y0, int x1, int y1, float *buf)
|
||||
{
|
||||
int dy = y1 - y0;
|
||||
int adx = x1 - x0;
|
||||
@@ -183,10 +183,10 @@ static void render_line(int x0, int y0, int x1, int y1, float *buf)
|
||||
if (ady*2 <= adx) { // optimized common case
|
||||
render_line_unrolled(x0, y0, x1, sy, ady, adx, buf);
|
||||
} else {
|
||||
int base = dy / adx;
|
||||
int x = x0;
|
||||
int y = y0;
|
||||
int err = -adx;
|
||||
int base = dy / adx;
|
||||
int x = x0;
|
||||
uint8_t y = y0;
|
||||
int err = -adx;
|
||||
ady -= FFABS(base) * adx;
|
||||
while (++x < x1) {
|
||||
y += base;
|
||||
@@ -204,7 +204,8 @@ void ff_vorbis_floor1_render_list(vorbis_floor1_entry * list, int values,
|
||||
uint16_t *y_list, int *flag,
|
||||
int multiplier, float *out, int samples)
|
||||
{
|
||||
int lx, ly, i;
|
||||
int lx, i;
|
||||
uint8_t ly;
|
||||
lx = 0;
|
||||
ly = y_list[0] * multiplier;
|
||||
for (i = 1; i < values; i++) {
|
||||
|
@@ -660,7 +660,7 @@ static int vorbis_parse_setup_hdr_residues(vorbis_context *vc)
|
||||
res_setup->partition_size = get_bits(gb, 24) + 1;
|
||||
/* Validations to prevent a buffer overflow later. */
|
||||
if (res_setup->begin>res_setup->end ||
|
||||
res_setup->end > vc->avccontext->channels * vc->blocksize[1] / 2 ||
|
||||
res_setup->end > (res_setup->type == 2 ? vc->avccontext->channels : 1) * vc->blocksize[1] / 2 ||
|
||||
(res_setup->end-res_setup->begin) / res_setup->partition_size > V_MAX_PARTITIONS) {
|
||||
av_log(vc->avccontext, AV_LOG_ERROR,
|
||||
"partition out of bounds: type, begin, end, size, blocksize: %"PRIu16", %"PRIu32", %"PRIu32", %u, %"PRIu32"\n",
|
||||
@@ -1269,6 +1269,7 @@ static av_always_inline int vorbis_residue_decode_internal(vorbis_context *vc,
|
||||
uint8_t *do_not_decode,
|
||||
float *vec,
|
||||
unsigned vlen,
|
||||
unsigned ch_left,
|
||||
int vr_type)
|
||||
{
|
||||
GetBitContext *gb = &vc->gb;
|
||||
@@ -1276,6 +1277,7 @@ static av_always_inline int vorbis_residue_decode_internal(vorbis_context *vc,
|
||||
unsigned ptns_to_read = vr->ptns_to_read;
|
||||
uint8_t *classifs = vr->classifs;
|
||||
unsigned pass, ch_used, i, j, k, l;
|
||||
unsigned max_output = (ch - 1) * vlen;
|
||||
|
||||
if (vr_type == 2) {
|
||||
for (j = 1; j < ch; ++j)
|
||||
@@ -1283,8 +1285,15 @@ static av_always_inline int vorbis_residue_decode_internal(vorbis_context *vc,
|
||||
if (do_not_decode[0])
|
||||
return 0;
|
||||
ch_used = 1;
|
||||
max_output += vr->end / ch;
|
||||
} else {
|
||||
ch_used = ch;
|
||||
max_output += vr->end;
|
||||
}
|
||||
|
||||
if (max_output > ch_left * vlen) {
|
||||
av_log(vc->avccontext, AV_LOG_ERROR, "Insufficient output buffer\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
av_dlog(NULL, " residue type 0/1/2 decode begin, ch: %d cpc %d \n", ch, c_p_c);
|
||||
@@ -1411,14 +1420,15 @@ static av_always_inline int vorbis_residue_decode_internal(vorbis_context *vc,
|
||||
static inline int vorbis_residue_decode(vorbis_context *vc, vorbis_residue *vr,
|
||||
unsigned ch,
|
||||
uint8_t *do_not_decode,
|
||||
float *vec, unsigned vlen)
|
||||
float *vec, unsigned vlen,
|
||||
unsigned ch_left)
|
||||
{
|
||||
if (vr->type == 2)
|
||||
return vorbis_residue_decode_internal(vc, vr, ch, do_not_decode, vec, vlen, 2);
|
||||
return vorbis_residue_decode_internal(vc, vr, ch, do_not_decode, vec, vlen, ch_left, 2);
|
||||
else if (vr->type == 1)
|
||||
return vorbis_residue_decode_internal(vc, vr, ch, do_not_decode, vec, vlen, 1);
|
||||
return vorbis_residue_decode_internal(vc, vr, ch, do_not_decode, vec, vlen, ch_left, 1);
|
||||
else if (vr->type == 0)
|
||||
return vorbis_residue_decode_internal(vc, vr, ch, do_not_decode, vec, vlen, 0);
|
||||
return vorbis_residue_decode_internal(vc, vr, ch, do_not_decode, vec, vlen, ch_left, 0);
|
||||
else {
|
||||
av_log(vc->avccontext, AV_LOG_ERROR, " Invalid residue type while residue decode?! \n");
|
||||
return -1;
|
||||
@@ -1466,6 +1476,8 @@ static int vorbis_parse_audio_packet(vorbis_context *vc)
|
||||
uint8_t res_chan[255];
|
||||
unsigned res_num = 0;
|
||||
int retlen = 0;
|
||||
unsigned ch_left = vc->audio_channels;
|
||||
unsigned vlen;
|
||||
|
||||
if (get_bits1(gb)) {
|
||||
av_log(vc->avccontext, AV_LOG_ERROR, "Not a Vorbis I audio packet.\n");
|
||||
@@ -1485,11 +1497,12 @@ static int vorbis_parse_audio_packet(vorbis_context *vc)
|
||||
|
||||
blockflag = vc->modes[mode_number].blockflag;
|
||||
blocksize = vc->blocksize[blockflag];
|
||||
vlen = blocksize / 2;
|
||||
if (blockflag)
|
||||
skip_bits(gb, 2); // previous_window, next_window
|
||||
|
||||
memset(ch_res_ptr, 0, sizeof(float) * vc->audio_channels * blocksize / 2); //FIXME can this be removed ?
|
||||
memset(ch_floor_ptr, 0, sizeof(float) * vc->audio_channels * blocksize / 2); //FIXME can this be removed ?
|
||||
memset(ch_res_ptr, 0, sizeof(float) * vc->audio_channels * vlen); //FIXME can this be removed ?
|
||||
memset(ch_floor_ptr, 0, sizeof(float) * vc->audio_channels * vlen); //FIXME can this be removed ?
|
||||
|
||||
// Decode floor
|
||||
|
||||
@@ -1509,7 +1522,7 @@ static int vorbis_parse_audio_packet(vorbis_context *vc)
|
||||
return -1;
|
||||
}
|
||||
no_residue[i] = ret;
|
||||
ch_floor_ptr += blocksize / 2;
|
||||
ch_floor_ptr += vlen;
|
||||
}
|
||||
|
||||
// Nonzero vector propagate
|
||||
@@ -1526,6 +1539,7 @@ static int vorbis_parse_audio_packet(vorbis_context *vc)
|
||||
for (i = 0; i < mapping->submaps; ++i) {
|
||||
vorbis_residue *residue;
|
||||
unsigned ch = 0;
|
||||
int ret;
|
||||
|
||||
for (j = 0; j < vc->audio_channels; ++j) {
|
||||
if ((mapping->submaps == 1) || (i == mapping->mux[j])) {
|
||||
@@ -1540,9 +1554,18 @@ static int vorbis_parse_audio_packet(vorbis_context *vc)
|
||||
}
|
||||
}
|
||||
residue = &vc->residues[mapping->submap_residue[i]];
|
||||
vorbis_residue_decode(vc, residue, ch, do_not_decode, ch_res_ptr, blocksize/2);
|
||||
if (ch_left < ch) {
|
||||
av_log(vc->avccontext, AV_LOG_ERROR, "Too many channels in vorbis_floor_decode.\n");
|
||||
return -1;
|
||||
}
|
||||
if (ch) {
|
||||
ret = vorbis_residue_decode(vc, residue, ch, do_not_decode, ch_res_ptr, vlen, ch_left);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
}
|
||||
|
||||
ch_res_ptr += ch * blocksize / 2;
|
||||
ch_res_ptr += ch * vlen;
|
||||
ch_left -= ch;
|
||||
}
|
||||
|
||||
// Inverse coupling
|
||||
|
@@ -1308,6 +1308,10 @@ static inline int vp3_dequant(Vp3DecodeContext *s, Vp3Fragment *frag,
|
||||
case 1: // zero run
|
||||
s->dct_tokens[plane][i]++;
|
||||
i += (token >> 2) & 0x7f;
|
||||
if(i>63){
|
||||
av_log(s->avctx, AV_LOG_ERROR, "Coefficient index overflow\n");
|
||||
return -1;
|
||||
}
|
||||
block[perm[i]] = (token >> 9) * dequantizer[perm[i]];
|
||||
i++;
|
||||
break;
|
||||
@@ -1319,6 +1323,8 @@ static inline int vp3_dequant(Vp3DecodeContext *s, Vp3Fragment *frag,
|
||||
return i;
|
||||
}
|
||||
} while (i < 64);
|
||||
// return value is expected to be a valid level
|
||||
i--;
|
||||
end:
|
||||
// the actual DC+prediction is in the fragment structure
|
||||
block[0] = frag->dc * s->qmat[0][inter][plane][0];
|
||||
|
@@ -183,7 +183,8 @@ static void vp5_parse_coeff(VP56Context *s)
|
||||
model1 = model->coeff_dccv[pt];
|
||||
model2 = model->coeff_dcct[pt][ctx];
|
||||
|
||||
for (coeff_idx=0; coeff_idx<64; ) {
|
||||
coeff_idx = 0;
|
||||
for (;;) {
|
||||
if (vp56_rac_get_prob(c, model2[0])) {
|
||||
if (vp56_rac_get_prob(c, model2[2])) {
|
||||
if (vp56_rac_get_prob(c, model2[3])) {
|
||||
@@ -220,8 +221,11 @@ static void vp5_parse_coeff(VP56Context *s)
|
||||
ct = 0;
|
||||
s->coeff_ctx[vp56_b6to4[b]][coeff_idx] = 0;
|
||||
}
|
||||
coeff_idx++;
|
||||
if (coeff_idx >= 64)
|
||||
break;
|
||||
|
||||
cg = vp5_coeff_groups[++coeff_idx];
|
||||
cg = vp5_coeff_groups[coeff_idx];
|
||||
ctx = s->coeff_ctx[vp56_b6to4[b]][coeff_idx];
|
||||
model1 = model->coeff_ract[pt][ct][cg];
|
||||
model2 = cg > 2 ? model1 : model->coeff_acct[pt][ct][cg][ctx];
|
||||
|
@@ -440,7 +440,8 @@ static void vp6_parse_coeff(VP56Context *s)
|
||||
model1 = model->coeff_dccv[pt];
|
||||
model2 = model->coeff_dcct[pt][ctx];
|
||||
|
||||
for (coeff_idx=0; coeff_idx<64; ) {
|
||||
coeff_idx = 0;
|
||||
for (;;) {
|
||||
if ((coeff_idx>1 && ct==0) || vp56_rac_get_prob(c, model2[0])) {
|
||||
/* parse a coeff */
|
||||
if (vp56_rac_get_prob(c, model2[2])) {
|
||||
@@ -481,8 +482,10 @@ static void vp6_parse_coeff(VP56Context *s)
|
||||
run += vp56_rac_get_prob(c, model3[i+8]) << i;
|
||||
}
|
||||
}
|
||||
|
||||
cg = vp6_coeff_groups[coeff_idx+=run];
|
||||
coeff_idx += run;
|
||||
if (coeff_idx >= 64)
|
||||
break;
|
||||
cg = vp6_coeff_groups[coeff_idx];
|
||||
model1 = model2 = model->coeff_ract[pt][ct][cg];
|
||||
}
|
||||
|
||||
|
@@ -137,6 +137,9 @@ int ff_wma_init(AVCodecContext *avctx, int flags2)
|
||||
|
||||
/* compute MDCT block size */
|
||||
s->frame_len_bits = ff_wma_get_frame_len_bits(s->sample_rate, s->version, 0);
|
||||
s->next_block_len_bits = s->frame_len_bits;
|
||||
s->prev_block_len_bits = s->frame_len_bits;
|
||||
s->block_len_bits = s->frame_len_bits;
|
||||
|
||||
s->frame_len = 1 << s->frame_len_bits;
|
||||
if (s->use_variable_block_len) {
|
||||
|
@@ -109,6 +109,11 @@ static int wma_decode_init(AVCodecContext * avctx)
|
||||
}
|
||||
}
|
||||
|
||||
if(avctx->channels > MAX_CHANNELS){
|
||||
av_log(avctx, AV_LOG_ERROR, "Invalid number of channels (%d)\n", avctx->channels);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if(ff_wma_init(avctx, flags2)<0)
|
||||
return -1;
|
||||
|
||||
|
@@ -100,8 +100,8 @@ static int ws_snd_decode_frame(AVCodecContext *avctx,
|
||||
|
||||
/* make sure we don't write more than out_size samples */
|
||||
switch (code) {
|
||||
case 0: smp = 4; break;
|
||||
case 1: smp = 2; break;
|
||||
case 0: smp = 4*(count+1); break;
|
||||
case 1: smp = 2*(count+1); break;
|
||||
case 2: smp = (count & 0x20) ? 1 : count + 1; break;
|
||||
default: smp = count + 1; break;
|
||||
}
|
||||
|
@@ -25,6 +25,11 @@
|
||||
|
||||
#include "avcodec.h"
|
||||
|
||||
#if LIBAVCODEC_VERSION_MAJOR < 53
|
||||
#define AV_XVMC_STATE_DISPLAY_PENDING 1 /** the surface should be shown, the video driver manipulates this */
|
||||
#define AV_XVMC_STATE_PREDICTION 2 /** the surface is needed for prediction, the codec manipulates this */
|
||||
#define AV_XVMC_STATE_OSD_SOURCE 4 /** the surface is needed for subpicture rendering */
|
||||
#endif
|
||||
#define AV_XVMC_ID 0x1DC711C0 /**< special value to ensure that regular pixel routines haven't corrupted the struct
|
||||
the number is 1337 speak for the letters IDCT MCo (motion compensation) */
|
||||
|
||||
@@ -146,6 +151,22 @@ struct xvmc_pix_fmt {
|
||||
of coded blocks it contains.
|
||||
*/
|
||||
int next_free_data_block_num;
|
||||
|
||||
/** extensions may be placed here */
|
||||
#if LIBAVCODEC_VERSION_MAJOR < 53
|
||||
//@{
|
||||
/** State flags used to work around limitations in the MPlayer video system.
|
||||
0 - Surface is not used.
|
||||
1 - Surface is still held in application to be displayed or is
|
||||
still visible.
|
||||
2 - Surface is still held in libavcodec buffer for prediction.
|
||||
*/
|
||||
int state;
|
||||
|
||||
/** pointer to the surface where the subpicture is rendered */
|
||||
void* p_osd_target_surface_render;
|
||||
//}@
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif /* AVCODEC_XVMC_H */
|
||||
|
@@ -22,9 +22,9 @@
|
||||
#include "libavutil/avutil.h"
|
||||
#include "libavformat/avformat.h"
|
||||
|
||||
#define LIBAVDEVICE_VERSION_MAJOR 53
|
||||
#define LIBAVDEVICE_VERSION_MINOR 1
|
||||
#define LIBAVDEVICE_VERSION_MICRO 1
|
||||
#define LIBAVDEVICE_VERSION_MAJOR 52
|
||||
#define LIBAVDEVICE_VERSION_MINOR 5
|
||||
#define LIBAVDEVICE_VERSION_MICRO 0
|
||||
|
||||
#define LIBAVDEVICE_VERSION_INT AV_VERSION_INT(LIBAVDEVICE_VERSION_MAJOR, \
|
||||
LIBAVDEVICE_VERSION_MINOR, \
|
||||
|
@@ -439,7 +439,7 @@ static int v4l2_set_parameters(AVFormatContext *s1, AVFormatParameters *ap)
|
||||
struct v4l2_streamparm streamparm = {0};
|
||||
struct v4l2_fract *tpf = &streamparm.parm.capture.timeperframe;
|
||||
int i, ret;
|
||||
AVRational fps;
|
||||
AVRational fps={0};
|
||||
|
||||
streamparm.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
|
||||
|
||||
|
@@ -614,7 +614,7 @@ void avfilter_filter_samples(AVFilterLink *link, AVFilterBufferRef *samplesref)
|
||||
link->cur_buf->audio->sample_rate = samplesref->audio->sample_rate;
|
||||
|
||||
/* Copy actual data into new samples buffer */
|
||||
for (i = 0; samplesref->data[i]; i++)
|
||||
for (i = 0; samplesref->data[i] && i < 8; i++)
|
||||
memcpy(link->cur_buf->data[i], samplesref->data[i], samplesref->linesize[0]);
|
||||
|
||||
avfilter_unref_buffer(samplesref);
|
||||
|
@@ -25,8 +25,8 @@
|
||||
#include "libavutil/avutil.h"
|
||||
#include "libavutil/samplefmt.h"
|
||||
|
||||
#define LIBAVFILTER_VERSION_MAJOR 2
|
||||
#define LIBAVFILTER_VERSION_MINOR 23
|
||||
#define LIBAVFILTER_VERSION_MAJOR 1
|
||||
#define LIBAVFILTER_VERSION_MINOR 80
|
||||
#define LIBAVFILTER_VERSION_MICRO 0
|
||||
|
||||
#define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
|
||||
|
@@ -158,7 +158,7 @@ static int read_shape_from_file(int *cols, int *rows, int **values, const char *
|
||||
}
|
||||
w++;
|
||||
}
|
||||
if (*rows > (SIZE_MAX / sizeof(int) / *cols)) {
|
||||
if (*rows > (FF_INTERNAL_MEM_TYPE_MAX_VALUE / (sizeof(int)) / *cols)) {
|
||||
av_log(log_ctx, AV_LOG_ERROR, "File with size %dx%d is too big\n",
|
||||
*rows, *cols);
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
@@ -69,16 +69,13 @@ static int query_formats(AVFilterContext *ctx)
|
||||
PIX_FMT_BGR555BE, PIX_FMT_BGR555LE,
|
||||
PIX_FMT_GRAY16BE, PIX_FMT_GRAY16LE,
|
||||
PIX_FMT_YUV420P16LE, PIX_FMT_YUV420P16BE,
|
||||
PIX_FMT_YUV422P16LE, PIX_FMT_YUV422P16BE,
|
||||
PIX_FMT_YUV444P16LE, PIX_FMT_YUV444P16BE,
|
||||
PIX_FMT_NV12, PIX_FMT_NV21,
|
||||
PIX_FMT_RGB8, PIX_FMT_BGR8,
|
||||
PIX_FMT_RGB4_BYTE, PIX_FMT_BGR4_BYTE,
|
||||
PIX_FMT_YUV444P, PIX_FMT_YUV422P,
|
||||
PIX_FMT_YUV444P, PIX_FMT_YUVJ444P,
|
||||
PIX_FMT_YUV420P, PIX_FMT_YUVJ420P,
|
||||
PIX_FMT_YUV411P, PIX_FMT_YUV410P,
|
||||
PIX_FMT_YUVJ444P, PIX_FMT_YUVJ422P,
|
||||
PIX_FMT_YUV440P, PIX_FMT_YUVJ440P,
|
||||
PIX_FMT_YUV410P,
|
||||
PIX_FMT_YUVA420P, PIX_FMT_GRAY8,
|
||||
PIX_FMT_NONE
|
||||
};
|
||||
@@ -195,6 +192,8 @@ static void end_frame(AVFilterLink *inlink)
|
||||
avfilter_unref_buffer(outpic);
|
||||
}
|
||||
|
||||
static void null_draw_slice(AVFilterLink *link, int y, int h, int slice_dir) { }
|
||||
|
||||
AVFilter avfilter_vf_transpose = {
|
||||
.name = "transpose",
|
||||
.description = NULL_IF_CONFIG_SMALL("Transpose input video."),
|
||||
@@ -207,6 +206,7 @@ AVFilter avfilter_vf_transpose = {
|
||||
.inputs = (AVFilterPad[]) {{ .name = "default",
|
||||
.type = AVMEDIA_TYPE_VIDEO,
|
||||
.start_frame = start_frame,
|
||||
.draw_slice = null_draw_slice,
|
||||
.end_frame = end_frame,
|
||||
.min_perms = AV_PERM_READ, },
|
||||
{ .name = NULL}},
|
||||
|
@@ -10,6 +10,7 @@ OBJS = allformats.o \
|
||||
id3v1.o \
|
||||
id3v2.o \
|
||||
metadata.o \
|
||||
metadata_compat.o \
|
||||
options.o \
|
||||
os_support.o \
|
||||
sdp.o \
|
||||
@@ -247,6 +248,7 @@ OBJS-$(CONFIG_RTPDEC) += rdt.o \
|
||||
rtpdec.o \
|
||||
rtpdec_amr.o \
|
||||
rtpdec_asf.o \
|
||||
rtpdec_g726.o \
|
||||
rtpdec_h263.o \
|
||||
rtpdec_h264.o \
|
||||
rtpdec_latm.o \
|
||||
|
@@ -40,6 +40,8 @@ static int ac3_eac3_probe(AVProbeData *p, enum CodecID expected_codec_id)
|
||||
buf2 = buf;
|
||||
|
||||
for(frames = 0; buf2 < end; frames++) {
|
||||
if(!memcmp(buf2, "\x1\x10\0\0\0\0\0\0", 8))
|
||||
buf2+=16;
|
||||
init_get_bits(&gbc, buf2, 54);
|
||||
if(ff_ac3_parse_header(&gbc, &hdr) < 0)
|
||||
break;
|
||||
|
@@ -208,7 +208,7 @@ static int parse_playlist(AppleHTTPContext *c, const char *url,
|
||||
|
||||
if (!in) {
|
||||
close_in = 1;
|
||||
if ((ret = avio_open(&in, url, AVIO_FLAG_READ)) < 0)
|
||||
if ((ret = avio_open(&in, url, AVIO_RDONLY)) < 0)
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -321,13 +321,13 @@ static int open_input(struct variant *var)
|
||||
{
|
||||
struct segment *seg = var->segments[var->cur_seq_no - var->start_seq_no];
|
||||
if (seg->key_type == KEY_NONE) {
|
||||
return ffurl_open(&var->input, seg->url, AVIO_FLAG_READ);
|
||||
return ffurl_open(&var->input, seg->url, AVIO_RDONLY);
|
||||
} else if (seg->key_type == KEY_AES_128) {
|
||||
char iv[33], key[33], url[MAX_URL_SIZE];
|
||||
int ret;
|
||||
if (strcmp(seg->key, var->key_url)) {
|
||||
URLContext *uc;
|
||||
if (ffurl_open(&uc, seg->key, AVIO_FLAG_READ) == 0) {
|
||||
if (ffurl_open(&uc, seg->key, AVIO_RDONLY) == 0) {
|
||||
if (ffurl_read_complete(uc, var->key, sizeof(var->key))
|
||||
!= sizeof(var->key)) {
|
||||
av_log(NULL, AV_LOG_ERROR, "Unable to read key file %s\n",
|
||||
@@ -347,7 +347,7 @@ static int open_input(struct variant *var)
|
||||
snprintf(url, sizeof(url), "crypto+%s", seg->url);
|
||||
else
|
||||
snprintf(url, sizeof(url), "crypto:%s", seg->url);
|
||||
if ((ret = ffurl_alloc(&var->input, url, AVIO_FLAG_READ)) < 0)
|
||||
if ((ret = ffurl_alloc(&var->input, url, AVIO_RDONLY)) < 0)
|
||||
return ret;
|
||||
av_set_string3(var->input->priv_data, "key", key, 0, NULL);
|
||||
av_set_string3(var->input->priv_data, "iv", iv, 0, NULL);
|
||||
@@ -395,7 +395,9 @@ reload:
|
||||
goto reload;
|
||||
}
|
||||
|
||||
ret = open_input(v);
|
||||
ret = ffurl_open(&v->input,
|
||||
v->segments[v->cur_seq_no - v->start_seq_no]->url,
|
||||
AVIO_RDONLY);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
}
|
||||
|
@@ -114,7 +114,7 @@ static int parse_playlist(URLContext *h, const char *url)
|
||||
char line[1024];
|
||||
const char *ptr;
|
||||
|
||||
if ((ret = avio_open(&in, url, AVIO_FLAG_READ)) < 0)
|
||||
if ((ret = avio_open(&in, url, AVIO_RDONLY)) < 0)
|
||||
return ret;
|
||||
|
||||
read_chomp_line(in, line, sizeof(line));
|
||||
@@ -179,7 +179,7 @@ static int applehttp_open(URLContext *h, const char *uri, int flags)
|
||||
int ret, i;
|
||||
const char *nested_url;
|
||||
|
||||
if (flags & AVIO_FLAG_WRITE)
|
||||
if (flags & (AVIO_WRONLY | AVIO_RDWR))
|
||||
return AVERROR(ENOSYS);
|
||||
|
||||
s = av_mallocz(sizeof(AppleHTTPContext));
|
||||
@@ -194,7 +194,7 @@ static int applehttp_open(URLContext *h, const char *uri, int flags)
|
||||
av_strlcpy(s->playlisturl, "http://", sizeof(s->playlisturl));
|
||||
av_strlcat(s->playlisturl, nested_url, sizeof(s->playlisturl));
|
||||
} else {
|
||||
av_log(h, AV_LOG_ERROR, "Unsupported url %s\n", uri);
|
||||
av_log(NULL, AV_LOG_ERROR, "Unsupported url %s\n", uri);
|
||||
ret = AVERROR(EINVAL);
|
||||
goto fail;
|
||||
}
|
||||
@@ -217,7 +217,7 @@ static int applehttp_open(URLContext *h, const char *uri, int flags)
|
||||
}
|
||||
|
||||
if (s->n_segments == 0) {
|
||||
av_log(h, AV_LOG_WARNING, "Empty playlist\n");
|
||||
av_log(NULL, AV_LOG_WARNING, "Empty playlist\n");
|
||||
ret = AVERROR(EIO);
|
||||
goto fail;
|
||||
}
|
||||
@@ -257,7 +257,7 @@ retry:
|
||||
return ret;
|
||||
}
|
||||
if (s->cur_seq_no < s->start_seq_no) {
|
||||
av_log(h, AV_LOG_WARNING,
|
||||
av_log(NULL, AV_LOG_WARNING,
|
||||
"skipping %d segments ahead, expired from playlist\n",
|
||||
s->start_seq_no - s->cur_seq_no);
|
||||
s->cur_seq_no = s->start_seq_no;
|
||||
@@ -273,12 +273,12 @@ retry:
|
||||
goto retry;
|
||||
}
|
||||
url = s->segments[s->cur_seq_no - s->start_seq_no]->url,
|
||||
av_log(h, AV_LOG_DEBUG, "opening %s\n", url);
|
||||
ret = ffurl_open(&s->seg_hd, url, AVIO_FLAG_READ);
|
||||
av_log(NULL, AV_LOG_DEBUG, "opening %s\n", url);
|
||||
ret = ffurl_open(&s->seg_hd, url, AVIO_RDONLY);
|
||||
if (ret < 0) {
|
||||
if (url_interrupt_cb())
|
||||
return AVERROR_EXIT;
|
||||
av_log(h, AV_LOG_WARNING, "Unable to open %s\n", url);
|
||||
av_log(NULL, AV_LOG_WARNING, "Unable to open %s\n", url);
|
||||
s->cur_seq_no++;
|
||||
goto retry;
|
||||
}
|
||||
|
@@ -45,8 +45,6 @@ typedef struct {
|
||||
|
||||
uint16_t stream_language_index;
|
||||
|
||||
int palette_changed;
|
||||
uint32_t palette[256];
|
||||
} ASFStream;
|
||||
|
||||
typedef struct {
|
||||
|
@@ -359,14 +359,15 @@ static int asf_read_stream_properties(AVFormatContext *s, int64_t size)
|
||||
/* This is true for all paletted codecs implemented in ffmpeg */
|
||||
if (st->codec->extradata_size && (st->codec->bits_per_coded_sample <= 8)) {
|
||||
int av_unused i;
|
||||
st->codec->palctrl = av_mallocz(sizeof(AVPaletteControl));
|
||||
#if HAVE_BIGENDIAN
|
||||
for (i = 0; i < FFMIN(st->codec->extradata_size, AVPALETTE_SIZE)/4; i++)
|
||||
asf_st->palette[i] = av_bswap32(((uint32_t*)st->codec->extradata)[i]);
|
||||
st->codec->palctrl->palette[i] = av_bswap32(((uint32_t*)st->codec->extradata)[i]);
|
||||
#else
|
||||
memcpy(asf_st->palette, st->codec->extradata,
|
||||
FFMIN(st->codec->extradata_size, AVPALETTE_SIZE));
|
||||
memcpy(st->codec->palctrl->palette, st->codec->extradata,
|
||||
FFMIN(st->codec->extradata_size, AVPALETTE_SIZE));
|
||||
#endif
|
||||
asf_st->palette_changed = 1;
|
||||
st->codec->palctrl->palette_changed = 1;
|
||||
}
|
||||
|
||||
st->codec->codec_tag = tag1;
|
||||
@@ -970,17 +971,6 @@ static int ff_asf_parse_packet(AVFormatContext *s, AVIOContext *pb, AVPacket *pk
|
||||
asf_st->pkt.stream_index = asf->stream_index;
|
||||
asf_st->pkt.pos =
|
||||
asf_st->packet_pos= asf->packet_pos;
|
||||
if (asf_st->pkt.data && asf_st->palette_changed) {
|
||||
uint8_t *pal;
|
||||
pal = av_packet_new_side_data(pkt, AV_PKT_DATA_PALETTE,
|
||||
AVPALETTE_SIZE);
|
||||
if (!pal) {
|
||||
av_log(s, AV_LOG_ERROR, "Cannot append palette to packet\n");
|
||||
} else {
|
||||
memcpy(pal, asf_st->palette, AVPALETTE_SIZE);
|
||||
asf_st->palette_changed = 0;
|
||||
}
|
||||
}
|
||||
//printf("new packet: stream:%d key:%d packet_key:%d audio:%d size:%d\n",
|
||||
//asf->stream_index, asf->packet_key_frame, asf_st->pkt.flags & AV_PKT_FLAG_KEY,
|
||||
//s->streams[asf->stream_index]->codec->codec_type == AVMEDIA_TYPE_AUDIO, asf->packet_obj_size);
|
||||
@@ -1137,8 +1127,14 @@ static void asf_reset_header(AVFormatContext *s)
|
||||
|
||||
static int asf_read_close(AVFormatContext *s)
|
||||
{
|
||||
int i;
|
||||
asf_reset_header(s);
|
||||
|
||||
for(i=0;i<s->nb_streams;i++) {
|
||||
AVStream *st = s->streams[i];
|
||||
av_free(st->codec->palctrl);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@@ -144,6 +144,20 @@ typedef struct AVMetadataConv AVMetadataConv;
|
||||
attribute_deprecated AVDictionaryEntry *
|
||||
av_metadata_get(AVDictionary *m, const char *key, const AVDictionaryEntry *prev, int flags);
|
||||
|
||||
#if FF_API_OLD_METADATA
|
||||
/**
|
||||
* Set the given tag in *pm, overwriting an existing tag.
|
||||
*
|
||||
* @param pm pointer to a pointer to a metadata struct. If *pm is NULL
|
||||
* a metadata struct is allocated and put in *pm.
|
||||
* @param key tag key to add to *pm (will be av_strduped)
|
||||
* @param value tag value to add to *pm (will be av_strduped)
|
||||
* @return >= 0 on success otherwise an error code <0
|
||||
* @deprecated Use av_metadata_set2() instead.
|
||||
*/
|
||||
attribute_deprecated int av_metadata_set(AVMetadata **pm, const char *key, const char *value);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Set the given tag in *pm, overwriting an existing tag.
|
||||
*
|
||||
@@ -256,6 +270,10 @@ typedef struct AVFormatParameters {
|
||||
immediately (RTSP only). */
|
||||
attribute_deprecated unsigned int prealloced_context:1;
|
||||
#endif
|
||||
#if FF_API_PARAMETERS_CODEC_ID
|
||||
attribute_deprecated enum CodecID video_codec_id;
|
||||
attribute_deprecated enum CodecID audio_codec_id;
|
||||
#endif
|
||||
} AVFormatParameters;
|
||||
|
||||
//! Demuxer will use avio_open, no opened file should be provided by the caller.
|
||||
@@ -548,6 +566,10 @@ typedef struct AVStream {
|
||||
*/
|
||||
int64_t duration;
|
||||
|
||||
#if FF_API_OLD_METADATA
|
||||
attribute_deprecated char language[4]; /**< ISO 639-2/B 3-letter language code (empty string if undefined) */
|
||||
#endif
|
||||
|
||||
/* av_read_frame() support */
|
||||
enum AVStreamParseType need_parsing;
|
||||
struct AVCodecParserContext *parser;
|
||||
@@ -563,6 +585,14 @@ typedef struct AVStream {
|
||||
|
||||
int64_t nb_frames; ///< number of frames in this stream if known or 0
|
||||
|
||||
#if FF_API_LAVF_UNUSED
|
||||
attribute_deprecated int64_t unused[4+1];
|
||||
#endif
|
||||
|
||||
#if FF_API_OLD_METADATA
|
||||
attribute_deprecated char *filename; /**< source filename of the stream */
|
||||
#endif
|
||||
|
||||
int disposition; /**< AV_DISPOSITION_* bit field */
|
||||
|
||||
AVProbeData probe_data;
|
||||
@@ -653,6 +683,10 @@ typedef struct AVStream {
|
||||
*/
|
||||
typedef struct AVProgram {
|
||||
int id;
|
||||
#if FF_API_OLD_METADATA
|
||||
attribute_deprecated char *provider_name; ///< network name for DVB streams
|
||||
attribute_deprecated char *name; ///< service name for DVB streams
|
||||
#endif
|
||||
int flags;
|
||||
enum AVDiscard discard; ///< selects which program to discard and which to feed to the caller
|
||||
unsigned int *stream_index;
|
||||
@@ -671,9 +705,16 @@ typedef struct AVChapter {
|
||||
int id; ///< unique ID to identify the chapter
|
||||
AVRational time_base; ///< time base in which the start/end timestamps are specified
|
||||
int64_t start, end; ///< chapter start/end time in time_base units
|
||||
#if FF_API_OLD_METADATA
|
||||
attribute_deprecated char *title; ///< chapter title
|
||||
#endif
|
||||
AVDictionary *metadata;
|
||||
} AVChapter;
|
||||
|
||||
#if FF_API_MAX_STREAMS
|
||||
#define MAX_STREAMS 20
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Format I/O context.
|
||||
* New fields can be added to the end with minor version bumps.
|
||||
@@ -689,10 +730,24 @@ typedef struct AVFormatContext {
|
||||
void *priv_data;
|
||||
AVIOContext *pb;
|
||||
unsigned int nb_streams;
|
||||
#if FF_API_MAX_STREAMS
|
||||
AVStream *streams[MAX_STREAMS];
|
||||
#else
|
||||
AVStream **streams;
|
||||
#endif
|
||||
char filename[1024]; /**< input or output filename */
|
||||
/* stream info */
|
||||
int64_t timestamp;
|
||||
#if FF_API_OLD_METADATA
|
||||
attribute_deprecated char title[512];
|
||||
attribute_deprecated char author[512];
|
||||
attribute_deprecated char copyright[512];
|
||||
attribute_deprecated char comment[512];
|
||||
attribute_deprecated char album[512];
|
||||
attribute_deprecated int year; /**< ID3 year, 0 if none */
|
||||
attribute_deprecated int track; /**< track number, 0 if none */
|
||||
attribute_deprecated char genre[32]; /**< ID3 genre */
|
||||
#endif
|
||||
|
||||
int ctx_flags; /**< Format-specific flags, see AVFMTCTX_xx */
|
||||
/* private data for pts handling (do not modify directly). */
|
||||
@@ -732,9 +787,17 @@ typedef struct AVFormatContext {
|
||||
|
||||
/* av_read_frame() support */
|
||||
AVStream *cur_st;
|
||||
#if FF_API_LAVF_UNUSED
|
||||
const uint8_t *cur_ptr_deprecated;
|
||||
int cur_len_deprecated;
|
||||
AVPacket cur_pkt_deprecated;
|
||||
#endif
|
||||
|
||||
/* av_seek_frame() support */
|
||||
int64_t data_offset; /**< offset of the first packet */
|
||||
#if FF_API_INDEX_BUILT
|
||||
attribute_deprecated int index_built;
|
||||
#endif
|
||||
|
||||
int mux_rate;
|
||||
unsigned int packet_size;
|
||||
@@ -874,6 +937,11 @@ typedef struct AVPacketList {
|
||||
struct AVPacketList *next;
|
||||
} AVPacketList;
|
||||
|
||||
#if FF_API_FIRST_FORMAT
|
||||
attribute_deprecated extern AVInputFormat *first_iformat;
|
||||
attribute_deprecated extern AVOutputFormat *first_oformat;
|
||||
#endif
|
||||
|
||||
/**
|
||||
* If f is NULL, returns the first registered input format,
|
||||
* if f is non-NULL, returns the next registered input format after f
|
||||
@@ -898,6 +966,18 @@ attribute_deprecated enum CodecID av_guess_image2_codec(const char *filename);
|
||||
/* utils.c */
|
||||
void av_register_input_format(AVInputFormat *format);
|
||||
void av_register_output_format(AVOutputFormat *format);
|
||||
#if FF_API_GUESS_FORMAT
|
||||
attribute_deprecated AVOutputFormat *guess_stream_format(const char *short_name,
|
||||
const char *filename,
|
||||
const char *mime_type);
|
||||
|
||||
/**
|
||||
* @deprecated Use av_guess_format() instead.
|
||||
*/
|
||||
attribute_deprecated AVOutputFormat *guess_format(const char *short_name,
|
||||
const char *filename,
|
||||
const char *mime_type);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Return the output format in the list of registered output formats
|
||||
@@ -1114,6 +1194,12 @@ attribute_deprecated int av_open_input_file(AVFormatContext **ic_ptr, const char
|
||||
*/
|
||||
int avformat_open_input(AVFormatContext **ps, const char *filename, AVInputFormat *fmt, AVDictionary **options);
|
||||
|
||||
#if FF_API_ALLOC_FORMAT_CONTEXT
|
||||
/**
|
||||
* @deprecated Use avformat_alloc_context() instead.
|
||||
*/
|
||||
attribute_deprecated AVFormatContext *av_alloc_format_context(void);
|
||||
#endif
|
||||
int av_demuxer_open(AVFormatContext *ic, AVFormatParameters *ap);
|
||||
|
||||
/**
|
||||
@@ -1152,6 +1238,7 @@ AVFormatContext *avformat_alloc_output_context(const char *format,
|
||||
int avformat_alloc_output_context2(AVFormatContext **ctx, AVOutputFormat *oformat,
|
||||
const char *format_name, const char *filename);
|
||||
|
||||
#if FF_API_FORMAT_PARAMETERS
|
||||
/**
|
||||
* Read packets of a media file to get stream information. This
|
||||
* is useful for file formats with no headers such as MPEG. This
|
||||
@@ -1164,8 +1251,34 @@ int avformat_alloc_output_context2(AVFormatContext **ctx, AVOutputFormat *oforma
|
||||
* @return >=0 if OK, AVERROR_xxx on error
|
||||
* @todo Let the user decide somehow what information is needed so that
|
||||
* we do not waste time getting stuff the user does not need.
|
||||
*
|
||||
* @deprecated use avformat_find_stream_info.
|
||||
*/
|
||||
int av_find_stream_info(AVFormatContext *ic);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Read packets of a media file to get stream information. This
|
||||
* is useful for file formats with no headers such as MPEG. This
|
||||
* function also computes the real framerate in case of MPEG-2 repeat
|
||||
* frame mode.
|
||||
* The logical file position is not changed by this function;
|
||||
* examined packets may be buffered for later processing.
|
||||
*
|
||||
* @param ic media file handle
|
||||
* @param options If non-NULL, an ic.nb_streams long array of pointers to
|
||||
* dictionaries, where i-th member contains options for
|
||||
* codec corresponding to i-th stream.
|
||||
* On return each dictionary will be filled with options that were not found.
|
||||
* @return >=0 if OK, AVERROR_xxx on error
|
||||
*
|
||||
* @note this function isn't guaranteed to open all the codecs, so
|
||||
* options being non-empty at return is a perfectly normal behavior.
|
||||
*
|
||||
* @todo Let the user decide somehow what information is needed so that
|
||||
* we do not waste time getting stuff the user does not need.
|
||||
*/
|
||||
int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options);
|
||||
|
||||
/**
|
||||
* Find the "best" stream in the file.
|
||||
@@ -1540,6 +1653,22 @@ void av_dump_format(AVFormatContext *ic,
|
||||
const char *url,
|
||||
int is_output);
|
||||
|
||||
#if FF_API_PARSE_FRAME_PARAM
|
||||
/**
|
||||
* Parse width and height out of string str.
|
||||
* @deprecated Use av_parse_video_frame_size instead.
|
||||
*/
|
||||
attribute_deprecated int parse_image_size(int *width_ptr, int *height_ptr,
|
||||
const char *str);
|
||||
|
||||
/**
|
||||
* Convert framerate from a string to a fraction.
|
||||
* @deprecated Use av_parse_video_frame_rate instead.
|
||||
*/
|
||||
attribute_deprecated int parse_frame_rate(int *frame_rate, int *frame_rate_base,
|
||||
const char *arg);
|
||||
#endif
|
||||
|
||||
#if FF_API_PARSE_DATE
|
||||
/**
|
||||
* Parse datestr and return a corresponding number of microseconds.
|
||||
|
@@ -611,18 +611,15 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)
|
||||
/* This code assumes that extradata contains only palette. */
|
||||
/* This is true for all paletted codecs implemented in FFmpeg. */
|
||||
if (st->codec->extradata_size && (st->codec->bits_per_coded_sample <= 8)) {
|
||||
int pal_size = (1 << st->codec->bits_per_coded_sample) << 2;
|
||||
const uint8_t *pal_src;
|
||||
|
||||
pal_size = FFMIN(pal_size, st->codec->extradata_size);
|
||||
pal_src = st->codec->extradata + st->codec->extradata_size - pal_size;
|
||||
st->codec->palctrl = av_mallocz(sizeof(AVPaletteControl));
|
||||
#if HAVE_BIGENDIAN
|
||||
for (i = 0; i < pal_size/4; i++)
|
||||
ast->pal[i] = AV_RL32(pal_src+4*i);
|
||||
for (i = 0; i < FFMIN(st->codec->extradata_size, AVPALETTE_SIZE)/4; i++)
|
||||
st->codec->palctrl->palette[i] = av_bswap32(((uint32_t*)st->codec->extradata)[i]);
|
||||
#else
|
||||
memcpy(ast->pal, pal_src, pal_size);
|
||||
memcpy(st->codec->palctrl->palette, st->codec->extradata,
|
||||
FFMIN(st->codec->extradata_size, AVPALETTE_SIZE));
|
||||
#endif
|
||||
ast->has_pal = 1;
|
||||
st->codec->palctrl->palette_changed = 1;
|
||||
}
|
||||
|
||||
print_tag("video", tag1, 0);
|
||||
@@ -964,14 +961,14 @@ resync:
|
||||
return err;
|
||||
|
||||
if(ast->has_pal && pkt->data && pkt->size<(unsigned)INT_MAX/2){
|
||||
uint8_t *pal;
|
||||
pal = av_packet_new_side_data(pkt, AV_PKT_DATA_PALETTE, AVPALETTE_SIZE);
|
||||
if(!pal){
|
||||
av_log(s, AV_LOG_ERROR, "Failed to allocate data for palette\n");
|
||||
}else{
|
||||
memcpy(pal, ast->pal, AVPALETTE_SIZE);
|
||||
ast->has_pal = 0;
|
||||
}
|
||||
void *ptr= av_realloc(pkt->data, pkt->size + 4*256 + FF_INPUT_BUFFER_PADDING_SIZE);
|
||||
if(ptr){
|
||||
ast->has_pal=0;
|
||||
pkt->size += 4*256;
|
||||
pkt->data= ptr;
|
||||
memcpy(pkt->data + pkt->size - 4*256, ast->pal, 4*256);
|
||||
}else
|
||||
av_log(s, AV_LOG_ERROR, "Failed to append palette\n");
|
||||
}
|
||||
|
||||
if (CONFIG_DV_DEMUXER && avi->dv_demux) {
|
||||
@@ -1401,6 +1398,7 @@ static int avi_read_close(AVFormatContext *s)
|
||||
for(i=0;i<s->nb_streams;i++) {
|
||||
AVStream *st = s->streams[i];
|
||||
AVIStream *ast = st->priv_data;
|
||||
av_free(st->codec->palctrl);
|
||||
if (ast) {
|
||||
if (ast->sub_ctx) {
|
||||
av_freep(&ast->sub_ctx->pb);
|
||||
|
@@ -30,6 +30,7 @@
|
||||
#endif
|
||||
#include "url.h"
|
||||
|
||||
#if FF_API_URL_CLASS
|
||||
/** @name Logging context. */
|
||||
/*@{*/
|
||||
static const char *urlcontext_to_name(void *ptr)
|
||||
@@ -46,6 +47,7 @@ static const AVClass urlcontext_class = {
|
||||
.version = LIBAVUTIL_VERSION_INT,
|
||||
};
|
||||
/*@}*/
|
||||
#endif
|
||||
|
||||
static int default_interrupt_cb(void);
|
||||
|
||||
@@ -83,6 +85,29 @@ int ffurl_register_protocol(URLProtocol *protocol, int size)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if FF_API_REGISTER_PROTOCOL
|
||||
/* The layout of URLProtocol as of when major was bumped to 52 */
|
||||
struct URLProtocol_compat {
|
||||
const char *name;
|
||||
int (*url_open)(URLContext *h, const char *filename, int flags);
|
||||
int (*url_read)(URLContext *h, unsigned char *buf, int size);
|
||||
int (*url_write)(URLContext *h, unsigned char *buf, int size);
|
||||
int64_t (*url_seek)(URLContext *h, int64_t pos, int whence);
|
||||
int (*url_close)(URLContext *h);
|
||||
struct URLProtocol *next;
|
||||
};
|
||||
|
||||
int av_register_protocol(URLProtocol *protocol)
|
||||
{
|
||||
return ffurl_register_protocol(protocol, sizeof(struct URLProtocol_compat));
|
||||
}
|
||||
|
||||
int register_protocol(URLProtocol *protocol)
|
||||
{
|
||||
return ffurl_register_protocol(protocol, sizeof(struct URLProtocol_compat));
|
||||
}
|
||||
#endif
|
||||
|
||||
static int url_alloc_for_protocol (URLContext **puc, struct URLProtocol *up,
|
||||
const char *filename, int flags)
|
||||
{
|
||||
@@ -98,7 +123,9 @@ static int url_alloc_for_protocol (URLContext **puc, struct URLProtocol *up,
|
||||
err = AVERROR(ENOMEM);
|
||||
goto fail;
|
||||
}
|
||||
#if FF_API_URL_CLASS
|
||||
uc->av_class = &urlcontext_class;
|
||||
#endif
|
||||
uc->filename = (char *) &uc[1];
|
||||
strcpy(uc->filename, filename);
|
||||
uc->prot = up;
|
||||
@@ -130,7 +157,7 @@ int ffurl_connect(URLContext* uc)
|
||||
return err;
|
||||
uc->is_connected = 1;
|
||||
//We must be careful here as ffurl_seek() could be slow, for example for http
|
||||
if( (uc->flags & AVIO_FLAG_WRITE)
|
||||
if( (uc->flags & (AVIO_WRONLY | AVIO_RDWR))
|
||||
|| !strcmp(uc->prot->name, "file"))
|
||||
if(!uc->is_streamed && ffurl_seek(uc, 0, SEEK_SET) < 0)
|
||||
uc->is_streamed= 1;
|
||||
@@ -290,21 +317,21 @@ static inline int retry_transfer_wrapper(URLContext *h, unsigned char *buf, int
|
||||
|
||||
int ffurl_read(URLContext *h, unsigned char *buf, int size)
|
||||
{
|
||||
if (!(h->flags & AVIO_FLAG_READ))
|
||||
if (h->flags & AVIO_WRONLY)
|
||||
return AVERROR(EIO);
|
||||
return retry_transfer_wrapper(h, buf, size, 1, h->prot->url_read);
|
||||
}
|
||||
|
||||
int ffurl_read_complete(URLContext *h, unsigned char *buf, int size)
|
||||
{
|
||||
if (!(h->flags & AVIO_FLAG_READ))
|
||||
if (h->flags & AVIO_WRONLY)
|
||||
return AVERROR(EIO);
|
||||
return retry_transfer_wrapper(h, buf, size, size, h->prot->url_read);
|
||||
}
|
||||
|
||||
int ffurl_write(URLContext *h, const unsigned char *buf, int size)
|
||||
{
|
||||
if (!(h->flags & AVIO_FLAG_WRITE))
|
||||
if (!(h->flags & (AVIO_WRONLY | AVIO_RDWR)))
|
||||
return AVERROR(EIO);
|
||||
/* avoid sending too big packets */
|
||||
if (h->max_packet_size && size > h->max_packet_size)
|
||||
@@ -343,7 +370,7 @@ int ffurl_close(URLContext *h)
|
||||
int url_exist(const char *filename)
|
||||
{
|
||||
URLContext *h;
|
||||
if (ffurl_open(&h, filename, AVIO_FLAG_READ) < 0)
|
||||
if (ffurl_open(&h, filename, AVIO_RDONLY) < 0)
|
||||
return 0;
|
||||
ffurl_close(h);
|
||||
return 1;
|
||||
|
@@ -101,7 +101,9 @@ typedef struct {
|
||||
* @deprecated This struct will be made private
|
||||
*/
|
||||
typedef struct URLContext {
|
||||
#if FF_API_URL_CLASS
|
||||
const AVClass *av_class; ///< information for av_log(). Set by url_open().
|
||||
#endif
|
||||
struct URLProtocol *prot;
|
||||
int flags;
|
||||
int is_streamed; /**< true if streamed (no seek possible), default = false */
|
||||
@@ -150,9 +152,9 @@ attribute_deprecated int url_poll(URLPollEntry *poll_table, int n, int timeout);
|
||||
* constants, optionally ORed with other flags.
|
||||
* @{
|
||||
*/
|
||||
#define URL_RDONLY 1 /**< read-only */
|
||||
#define URL_WRONLY 2 /**< write-only */
|
||||
#define URL_RDWR (URL_RDONLY|URL_WRONLY) /**< read-write */
|
||||
#define URL_RDONLY 0 /**< read-only */
|
||||
#define URL_WRONLY 1 /**< write-only */
|
||||
#define URL_RDWR 2 /**< read-write */
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
@@ -344,7 +346,7 @@ attribute_deprecated int url_exist(const char *url);
|
||||
#endif // FF_API_OLD_AVIO
|
||||
|
||||
/**
|
||||
* Return AVIO_FLAG_* access flags corresponding to the access permissions
|
||||
* Return AVIO_* access flags corresponding to the access permissions
|
||||
* of the resource in url, or a negative value corresponding to an
|
||||
* AVERROR code in case of failure. The returned access flags are
|
||||
* masked by the value in flags.
|
||||
@@ -354,6 +356,9 @@ attribute_deprecated int url_exist(const char *url);
|
||||
* one call to another. Thus you should not trust the returned value,
|
||||
* unless you are sure that no other processes are accessing the
|
||||
* checked resource.
|
||||
*
|
||||
* @note This function is slightly broken until next major bump
|
||||
* because of AVIO_RDONLY == 0. Don't use it until then.
|
||||
*/
|
||||
int avio_check(const char *url, int flags);
|
||||
|
||||
@@ -365,6 +370,22 @@ int avio_check(const char *url, int flags);
|
||||
*/
|
||||
void avio_set_interrupt_cb(int (*interrupt_cb)(void));
|
||||
|
||||
#if FF_API_REGISTER_PROTOCOL
|
||||
extern URLProtocol *first_protocol;
|
||||
#endif
|
||||
|
||||
#if FF_API_REGISTER_PROTOCOL
|
||||
/**
|
||||
* @deprecated Use av_register_protocol() instead.
|
||||
*/
|
||||
attribute_deprecated int register_protocol(URLProtocol *protocol);
|
||||
|
||||
/**
|
||||
* @deprecated Use av_register_protocol2() instead.
|
||||
*/
|
||||
attribute_deprecated int av_register_protocol(URLProtocol *protocol);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Allocate and initialize an AVIOContext for buffered I/O. It must be later
|
||||
* freed with av_free().
|
||||
@@ -522,15 +543,29 @@ int avio_get_str16le(AVIOContext *pb, int maxlen, char *buf, int buflen);
|
||||
int avio_get_str16be(AVIOContext *pb, int maxlen, char *buf, int buflen);
|
||||
|
||||
|
||||
#if FF_API_URL_RESETBUF
|
||||
/** Reset the buffer for reading or writing.
|
||||
* @note Will drop any data currently in the buffer without transmitting it.
|
||||
* @param flags URL_RDONLY to set up the buffer for reading, or URL_WRONLY
|
||||
* to set up the buffer for writing. */
|
||||
int url_resetbuf(AVIOContext *s, int flags);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @name URL open modes
|
||||
* The flags argument to avio_open must be one of the following
|
||||
* constants, optionally ORed with other flags.
|
||||
* @{
|
||||
*/
|
||||
#define AVIO_FLAG_READ 1 /**< read-only */
|
||||
#define AVIO_FLAG_WRITE 2 /**< write-only */
|
||||
#define AVIO_FLAG_READ_WRITE (AVIO_FLAG_READ|AVIO_FLAG_WRITE) /**< read-write pseudo flag */
|
||||
#if LIBAVFORMAT_VERSION_MAJOR < 53
|
||||
#define AVIO_RDONLY 0 /**< read-only */
|
||||
#define AVIO_WRONLY 1 /**< write-only */
|
||||
#define AVIO_RDWR 2 /**< read-write */
|
||||
#else
|
||||
#define AVIO_RDONLY 1 /**< read-only */
|
||||
#define AVIO_WRONLY 2 /**< write-only */
|
||||
#define AVIO_RDWR 4 /**< read-write */
|
||||
#endif
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
@@ -547,7 +582,11 @@ int avio_get_str16be(AVIOContext *pb, int maxlen, char *buf, int buflen);
|
||||
* Warning: non-blocking protocols is work-in-progress; this flag may be
|
||||
* silently ignored.
|
||||
*/
|
||||
#if LIBAVFORMAT_VERSION_MAJOR < 53
|
||||
#define AVIO_FLAG_NONBLOCK 4
|
||||
#else
|
||||
#define AVIO_FLAG_NONBLOCK 8
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Create and initialize a AVIOContext for accessing the
|
||||
@@ -591,6 +630,10 @@ int avio_open_dyn_buf(AVIOContext **s);
|
||||
*/
|
||||
int avio_close_dyn_buf(AVIOContext *s, uint8_t **pbuffer);
|
||||
|
||||
#if FF_API_UDP_GET_FILE
|
||||
int udp_get_file_handle(URLContext *h);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Iterate through names of available protocols.
|
||||
* @note it is recommanded to use av_protocol_next() instead of this
|
||||
|
@@ -38,7 +38,9 @@
|
||||
#define SHORT_SEEK_THRESHOLD 4096
|
||||
|
||||
static void fill_buffer(AVIOContext *s);
|
||||
#if !FF_API_URL_RESETBUF
|
||||
static int url_resetbuf(AVIOContext *s, int flags);
|
||||
#endif
|
||||
|
||||
int ffio_init_context(AVIOContext *s,
|
||||
unsigned char *buffer,
|
||||
@@ -53,7 +55,7 @@ int ffio_init_context(AVIOContext *s,
|
||||
s->buffer_size = buffer_size;
|
||||
s->buf_ptr = buffer;
|
||||
s->opaque = opaque;
|
||||
url_resetbuf(s, write_flag ? AVIO_FLAG_WRITE : AVIO_FLAG_READ);
|
||||
url_resetbuf(s, write_flag ? AVIO_WRONLY : AVIO_RDONLY);
|
||||
s->write_packet = write_packet;
|
||||
s->read_packet = read_packet;
|
||||
s->seek = seek;
|
||||
@@ -857,7 +859,7 @@ int ffio_fdopen(AVIOContext **s, URLContext *h)
|
||||
}
|
||||
|
||||
if (ffio_init_context(*s, buffer, buffer_size,
|
||||
h->flags & AVIO_FLAG_WRITE, h,
|
||||
(h->flags & AVIO_WRONLY || h->flags & AVIO_RDWR), h,
|
||||
(void*)ffurl_read, (void*)ffurl_write, (void*)ffurl_seek) < 0) {
|
||||
av_free(buffer);
|
||||
av_freep(s);
|
||||
@@ -886,15 +888,24 @@ int ffio_set_buf_size(AVIOContext *s, int buf_size)
|
||||
s->buffer = buffer;
|
||||
s->buffer_size = buf_size;
|
||||
s->buf_ptr = buffer;
|
||||
url_resetbuf(s, s->write_flag ? AVIO_FLAG_WRITE : AVIO_FLAG_READ);
|
||||
url_resetbuf(s, s->write_flag ? AVIO_WRONLY : AVIO_RDONLY);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if FF_API_URL_RESETBUF
|
||||
int url_resetbuf(AVIOContext *s, int flags)
|
||||
#else
|
||||
static int url_resetbuf(AVIOContext *s, int flags)
|
||||
#endif
|
||||
{
|
||||
assert(flags == AVIO_FLAG_WRITE || flags == AVIO_FLAG_READ);
|
||||
#if FF_API_URL_RESETBUF
|
||||
if (flags & AVIO_RDWR)
|
||||
return AVERROR(EINVAL);
|
||||
#else
|
||||
assert(flags == AVIO_WRONLY || flags == AVIO_RDONLY);
|
||||
#endif
|
||||
|
||||
if (flags & AVIO_FLAG_WRITE) {
|
||||
if (flags & AVIO_WRONLY) {
|
||||
s->buf_end = s->buffer + s->buffer_size;
|
||||
s->write_flag = 1;
|
||||
} else {
|
||||
@@ -1052,7 +1063,7 @@ int url_open_buf(AVIOContext **s, uint8_t *buf, int buf_size, int flags)
|
||||
if(!*s)
|
||||
return AVERROR(ENOMEM);
|
||||
ret = ffio_init_context(*s, buf, buf_size,
|
||||
flags & AVIO_FLAG_WRITE,
|
||||
(flags & AVIO_WRONLY || flags & AVIO_RDWR),
|
||||
NULL, NULL, NULL, NULL);
|
||||
if(ret != 0)
|
||||
av_freep(s);
|
||||
|
@@ -76,12 +76,12 @@ static int crypto_open(URLContext *h, const char *uri, int flags)
|
||||
ret = AVERROR(EINVAL);
|
||||
goto err;
|
||||
}
|
||||
if (flags & AVIO_FLAG_WRITE) {
|
||||
if (flags == AVIO_WRONLY) {
|
||||
av_log(h, AV_LOG_ERROR, "Only decryption is supported currently\n");
|
||||
ret = AVERROR(ENOSYS);
|
||||
goto err;
|
||||
}
|
||||
if ((ret = ffurl_open(&c->hd, nested_url, AVIO_FLAG_READ)) < 0) {
|
||||
if ((ret = ffurl_open(&c->hd, nested_url, AVIO_RDONLY)) < 0) {
|
||||
av_log(h, AV_LOG_ERROR, "Unable to open input\n");
|
||||
goto err;
|
||||
}
|
||||
|
@@ -58,8 +58,9 @@ static int file_check(URLContext *h, int mask)
|
||||
if (ret < 0)
|
||||
return AVERROR(errno);
|
||||
|
||||
ret |= st.st_mode&S_IRUSR ? mask&AVIO_FLAG_READ : 0;
|
||||
ret |= st.st_mode&S_IWUSR ? mask&AVIO_FLAG_WRITE : 0;
|
||||
ret |= st.st_mode&S_IRUSR ? mask&AVIO_RDONLY : 0;
|
||||
ret |= st.st_mode&S_IWUSR ? mask&AVIO_WRONLY : 0;
|
||||
ret |= st.st_mode&S_IWUSR && st.st_mode&S_IRUSR ? mask&AVIO_RDWR : 0;
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -73,9 +74,9 @@ static int file_open(URLContext *h, const char *filename, int flags)
|
||||
|
||||
av_strstart(filename, "file:", &filename);
|
||||
|
||||
if (flags & AVIO_FLAG_WRITE && flags & AVIO_FLAG_READ) {
|
||||
if (flags & AVIO_RDWR) {
|
||||
access = O_CREAT | O_TRUNC | O_RDWR;
|
||||
} else if (flags & AVIO_FLAG_WRITE) {
|
||||
} else if (flags & AVIO_WRONLY) {
|
||||
access = O_CREAT | O_TRUNC | O_WRONLY;
|
||||
} else {
|
||||
access = O_RDONLY;
|
||||
@@ -131,7 +132,7 @@ static int pipe_open(URLContext *h, const char *filename, int flags)
|
||||
|
||||
fd = strtol(filename, &final, 10);
|
||||
if((filename == final) || *final ) {/* No digits found, or something like 10ab */
|
||||
if (flags & AVIO_FLAG_WRITE) {
|
||||
if (flags & AVIO_WRONLY) {
|
||||
fd = 1;
|
||||
} else {
|
||||
fd = 0;
|
||||
|
@@ -210,7 +210,7 @@ static int amf_parse_object(AVFormatContext *s, AVStream *astream, AVStream *vst
|
||||
case AMF_DATA_TYPE_OBJECT: {
|
||||
unsigned int keylen;
|
||||
|
||||
if (ioc->seekable && key && !strcmp(KEYFRAMES_TAG, key) && depth == 1)
|
||||
if (vstream && ioc->seekable && key && !strcmp(KEYFRAMES_TAG, key) && depth == 1)
|
||||
if (parse_keyframes_index(s, ioc, vstream, max_pos) < 0)
|
||||
av_log(s, AV_LOG_ERROR, "Keyframe index parsing failed\n");
|
||||
|
||||
|
@@ -50,7 +50,7 @@ static int gopher_connect(URLContext *h, const char *path)
|
||||
if (!path) return AVERROR(EINVAL);
|
||||
break;
|
||||
default:
|
||||
av_log(h, AV_LOG_WARNING,
|
||||
av_log(NULL, AV_LOG_WARNING,
|
||||
"Gopher protocol type '%c' not supported yet!\n",
|
||||
*path);
|
||||
return AVERROR(EINVAL);
|
||||
@@ -100,7 +100,7 @@ static int gopher_open(URLContext *h, const char *uri, int flags)
|
||||
ff_url_join(buf, sizeof(buf), "tcp", NULL, hostname, port, NULL);
|
||||
|
||||
s->hd = NULL;
|
||||
err = ffurl_open(&s->hd, buf, AVIO_FLAG_READ_WRITE);
|
||||
err = ffurl_open(&s->hd, buf, AVIO_RDWR);
|
||||
if (err < 0)
|
||||
goto fail;
|
||||
|
||||
|
@@ -73,7 +73,7 @@ void ff_http_set_headers(URLContext *h, const char *headers)
|
||||
int len = strlen(headers);
|
||||
|
||||
if (len && strcmp("\r\n", headers + len - 2))
|
||||
av_log(h, AV_LOG_ERROR, "No trailing CRLF found in HTTP header.\n");
|
||||
av_log(NULL, AV_LOG_ERROR, "No trailing CRLF found in HTTP header.\n");
|
||||
|
||||
av_strlcpy(s->headers, headers, sizeof(s->headers));
|
||||
}
|
||||
@@ -127,7 +127,7 @@ static int http_open_cnx(URLContext *h)
|
||||
port = 80;
|
||||
|
||||
ff_url_join(buf, sizeof(buf), "tcp", NULL, hostname, port, NULL);
|
||||
err = ffurl_open(&hd, buf, AVIO_FLAG_READ_WRITE);
|
||||
err = ffurl_open(&hd, buf, AVIO_RDWR);
|
||||
if (err < 0)
|
||||
goto fail;
|
||||
|
||||
@@ -235,7 +235,7 @@ static int process_line(URLContext *h, char *line, int line_count,
|
||||
* don't abort until all headers have been parsed. */
|
||||
if (s->http_code >= 400 && s->http_code < 600 && s->http_code != 401) {
|
||||
end += strspn(end, SPACE_CHARS);
|
||||
av_log(h, AV_LOG_WARNING, "HTTP error %d %s\n",
|
||||
av_log(NULL, AV_LOG_WARNING, "HTTP error %d %s\n",
|
||||
s->http_code, end);
|
||||
return -1;
|
||||
}
|
||||
@@ -301,7 +301,7 @@ static int http_connect(URLContext *h, const char *path, const char *hoststr,
|
||||
|
||||
|
||||
/* send http header */
|
||||
post = h->flags & AVIO_FLAG_WRITE;
|
||||
post = h->flags & AVIO_WRONLY;
|
||||
authstr = ff_http_auth_create_response(&s->auth_state, auth, path,
|
||||
post ? "POST" : "GET");
|
||||
|
||||
@@ -456,7 +456,7 @@ static int http_close(URLContext *h)
|
||||
HTTPContext *s = h->priv_data;
|
||||
|
||||
/* signal end of chunked encoding if used */
|
||||
if ((h->flags & AVIO_FLAG_WRITE) && s->chunksize != -1) {
|
||||
if ((h->flags & AVIO_WRONLY) && s->chunksize != -1) {
|
||||
ret = ffurl_write(s->hd, footer, sizeof(footer) - 1);
|
||||
ret = ret > 0 ? 0 : ret;
|
||||
}
|
||||
|
@@ -86,6 +86,8 @@ typedef struct IdcinDemuxContext {
|
||||
int audio_present;
|
||||
|
||||
int64_t pts;
|
||||
|
||||
AVPaletteControl palctrl;
|
||||
} IdcinDemuxContext;
|
||||
|
||||
static int idcin_probe(AVProbeData *p)
|
||||
@@ -170,6 +172,8 @@ static int idcin_read_header(AVFormatContext *s,
|
||||
if (avio_read(pb, st->codec->extradata, HUFFMAN_TABLE_SIZE) !=
|
||||
HUFFMAN_TABLE_SIZE)
|
||||
return AVERROR(EIO);
|
||||
/* save a reference in order to transport the palette */
|
||||
st->codec->palctrl = &idcin->palctrl;
|
||||
|
||||
/* if sample rate is 0, assume no audio */
|
||||
if (sample_rate) {
|
||||
@@ -222,7 +226,6 @@ static int idcin_read_packet(AVFormatContext *s,
|
||||
int palette_scale;
|
||||
unsigned char r, g, b;
|
||||
unsigned char palette_buffer[768];
|
||||
uint32_t palette[256];
|
||||
|
||||
if (url_feof(s->pb))
|
||||
return AVERROR(EIO);
|
||||
@@ -233,6 +236,7 @@ static int idcin_read_packet(AVFormatContext *s,
|
||||
return AVERROR(EIO);
|
||||
} else if (command == 1) {
|
||||
/* trigger a palette change */
|
||||
idcin->palctrl.palette_changed = 1;
|
||||
if (avio_read(pb, palette_buffer, 768) != 768)
|
||||
return AVERROR(EIO);
|
||||
/* scale the palette as necessary */
|
||||
@@ -247,7 +251,7 @@ static int idcin_read_packet(AVFormatContext *s,
|
||||
r = palette_buffer[i * 3 ] << palette_scale;
|
||||
g = palette_buffer[i * 3 + 1] << palette_scale;
|
||||
b = palette_buffer[i * 3 + 2] << palette_scale;
|
||||
palette[i] = (r << 16) | (g << 8) | (b);
|
||||
idcin->palctrl.palette[i] = (r << 16) | (g << 8) | (b);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -258,15 +262,6 @@ static int idcin_read_packet(AVFormatContext *s,
|
||||
ret= av_get_packet(pb, pkt, chunk_size);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
if (command == 1) {
|
||||
uint8_t *pal;
|
||||
|
||||
pal = av_packet_new_side_data(pkt, AV_PKT_DATA_PALETTE,
|
||||
AVPALETTE_SIZE);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
memcpy(pal, palette, AVPALETTE_SIZE);
|
||||
}
|
||||
pkt->stream_index = idcin->video_stream_index;
|
||||
pkt->pts = idcin->pts;
|
||||
} else {
|
||||
|
@@ -143,11 +143,11 @@ static int find_image_range(int *pfirst_index, int *plast_index,
|
||||
if (av_get_frame_filename(buf, sizeof(buf), path, first_index) < 0){
|
||||
*pfirst_index =
|
||||
*plast_index = 1;
|
||||
if (avio_check(buf, AVIO_FLAG_READ) > 0)
|
||||
if(url_exist(buf))
|
||||
return 0;
|
||||
return -1;
|
||||
}
|
||||
if (avio_check(buf, AVIO_FLAG_READ) > 0)
|
||||
if (url_exist(buf))
|
||||
break;
|
||||
}
|
||||
if (first_index == 5)
|
||||
@@ -165,7 +165,7 @@ static int find_image_range(int *pfirst_index, int *plast_index,
|
||||
if (av_get_frame_filename(buf, sizeof(buf), path,
|
||||
last_index + range1) < 0)
|
||||
goto fail;
|
||||
if (avio_check(buf, AVIO_FLAG_READ) <= 0)
|
||||
if (!url_exist(buf))
|
||||
break;
|
||||
range = range1;
|
||||
/* just in case... */
|
||||
@@ -314,7 +314,7 @@ static int read_packet(AVFormatContext *s1, AVPacket *pkt)
|
||||
s->path, s->img_number)<0 && s->img_number > 1)
|
||||
return AVERROR(EIO);
|
||||
for(i=0; i<3; i++){
|
||||
if (avio_open(&f[i], filename, AVIO_FLAG_READ) < 0) {
|
||||
if (avio_open(&f[i], filename, AVIO_RDONLY) < 0) {
|
||||
if(i==1)
|
||||
break;
|
||||
av_log(s1, AV_LOG_ERROR, "Could not open file : %s\n",filename);
|
||||
@@ -401,7 +401,7 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt)
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
for(i=0; i<3; i++){
|
||||
if (avio_open(&pb[i], filename, AVIO_FLAG_WRITE) < 0) {
|
||||
if (avio_open(&pb[i], filename, AVIO_WRONLY) < 0) {
|
||||
av_log(s, AV_LOG_ERROR, "Could not open file : %s\n",filename);
|
||||
return AVERROR(EIO);
|
||||
}
|
||||
|
@@ -83,6 +83,18 @@ void ff_read_frame_flush(AVFormatContext *s);
|
||||
/** Get the current time since NTP epoch in microseconds. */
|
||||
uint64_t ff_ntp_time(void);
|
||||
|
||||
#if FF_API_URL_SPLIT
|
||||
/**
|
||||
* @deprecated use av_url_split() instead
|
||||
*/
|
||||
void ff_url_split(char *proto, int proto_size,
|
||||
char *authorization, int authorization_size,
|
||||
char *hostname, int hostname_size,
|
||||
int *port_ptr,
|
||||
char *path, int path_size,
|
||||
const char *url);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Assemble a URL string from components. This is the reverse operation
|
||||
* of av_url_split.
|
||||
|
@@ -86,8 +86,6 @@ typedef struct IPMVEContext {
|
||||
unsigned int video_width;
|
||||
unsigned int video_height;
|
||||
int64_t video_pts;
|
||||
uint32_t palette[256];
|
||||
int has_palette;
|
||||
|
||||
unsigned int audio_bits;
|
||||
unsigned int audio_channels;
|
||||
@@ -107,6 +105,8 @@ typedef struct IPMVEContext {
|
||||
|
||||
int64_t next_chunk_offset;
|
||||
|
||||
AVPaletteControl palette_control;
|
||||
|
||||
} IPMVEContext;
|
||||
|
||||
static int load_ipmovie_packet(IPMVEContext *s, AVIOContext *pb,
|
||||
@@ -151,17 +151,6 @@ static int load_ipmovie_packet(IPMVEContext *s, AVIOContext *pb,
|
||||
if (av_new_packet(pkt, s->decode_map_chunk_size + s->video_chunk_size))
|
||||
return CHUNK_NOMEM;
|
||||
|
||||
if (s->has_palette) {
|
||||
uint8_t *pal;
|
||||
|
||||
pal = av_packet_new_side_data(pkt, AV_PKT_DATA_PALETTE,
|
||||
AVPALETTE_SIZE);
|
||||
if (pal) {
|
||||
memcpy(pal, s->palette, AVPALETTE_SIZE);
|
||||
s->has_palette = 0;
|
||||
}
|
||||
}
|
||||
|
||||
pkt->pos= s->decode_map_chunk_offset;
|
||||
avio_seek(pb, s->decode_map_chunk_offset, SEEK_SET);
|
||||
s->decode_map_chunk_offset = 0;
|
||||
@@ -455,9 +444,10 @@ static int process_ipmovie_chunk(IPMVEContext *s, AVIOContext *pb,
|
||||
r = scratch[j++] * 4;
|
||||
g = scratch[j++] * 4;
|
||||
b = scratch[j++] * 4;
|
||||
s->palette[i] = (r << 16) | (g << 8) | (b);
|
||||
s->palette_control.palette[i] = (r << 16) | (g << 8) | (b);
|
||||
}
|
||||
s->has_palette = 1;
|
||||
/* indicate a palette change */
|
||||
s->palette_control.palette_changed = 1;
|
||||
break;
|
||||
|
||||
case OPCODE_SET_PALETTE_COMPRESSED:
|
||||
@@ -571,6 +561,9 @@ static int ipmovie_read_header(AVFormatContext *s,
|
||||
st->codec->height = ipmovie->video_height;
|
||||
st->codec->bits_per_coded_sample = ipmovie->video_bpp;
|
||||
|
||||
/* palette considerations */
|
||||
st->codec->palctrl = &ipmovie->palette_control;
|
||||
|
||||
if (ipmovie->audio_type) {
|
||||
st = av_new_stream(s, 0);
|
||||
if (!st)
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user