summaryrefslogtreecommitdiff
path: root/libavcodec/decode.c
Commit message (Collapse)AuthorAge
* avcodec: add a subcharenc mode that disables UTF-8 checkwm42018-03-25
| | | | | | | | This is for applications which want to explicitly check for invalid UTF-8 manually, and take actions that are better than dropping invalid subtitles silently. (It's pretty much silent because sporadic avcodec error messages are so common that you can't reasonably display them in a prominent and meaningful way in a application GUI.)
* avcodec: remove unnecessary calls to ff_init_buffer_info()James Almer2018-02-14
| | | | | | | | And remove the function altogether while at it. It's a duplicate of another. Reviewed-by: wm4 <nfxjfg@googlemail.com> Signed-off-by: James Almer <jamrial@gmail.com>
* Merge commit 'cad739dace55e3446ef7180de688173cd19fb000'Mark Thompson2018-02-12
|\ | | | | | | | | | | | | * commit 'cad739dace55e3446ef7180de688173cd19fb000': lavc: Add per-thread surfaces in get_hw_frame_parameters() Merged-by: Mark Thompson <sw@jkqxz.net>
| * lavc: Add per-thread surfaces in get_hw_frame_parameters()Mark Thompson2018-02-11
| | | | | | | | | | | | | | | | This number is definitely required when frame threading is enabled, so add it here rather than forcing all users to handle it themselves. DXVA2 contained this addition in specific code as well (therefore being added twice in the internal case) - just remove it from there.
* | Merge commit '5b145290df2998a9836a93eb925289c6c8b63af0'Mark Thompson2018-02-12
|\| | | | | | | | | | | | | * commit '5b145290df2998a9836a93eb925289c6c8b63af0': lavc: Add support for increasing hardware frame pool sizes Merged-by: Mark Thompson <sw@jkqxz.net>
| * lavc: Add support for increasing hardware frame pool sizesMark Thompson2018-02-11
| | | | | | | | | | | | | | | | | | | | AVCodecContext.extra_hw_frames is added to the size of hardware frame pools created by libavcodec for APIs which require fixed-size pools. This allows the user to keep references to a greater number of frames after decode, which may be necessary for some use-cases. It is also added to the initial_pool_size value returned by avcodec_get_hw_frames_parameters() if a fixed-size pool is required.
| * lavc: Mark all AVHWAccel structures as constMark Thompson2017-12-19
| |
| * lavc: Use hardware config information in ff_get_format()Mark Thompson2017-12-19
| | | | | | | | | | | | | | | | | | | | | | This removes the dependency that hardware pixel formats previously had on AVHWAccel instances, meaning only those which actually do something need exist after this patch. Also updates avcodec_default_get_format() to be able to choose hardware formats if either a matching device has been supplied or no additional external configuration is required, and avcodec_get_hw_frames_parameters() to use the hardware config rather than searching the old hwaccel list.
| * lavc: fix hw_device_ctx operationwm42017-10-23
| | | | | | | | | | | | | | Commit b46a77f19d accidentally broke this (requested change that was added to the patch later and which was not fully tested). Signed-off-by: Mark Thompson <sw@jkqxz.net>
* | avcodec/decode: reset codec on receiving packet after EOF in compat_decodeJames Cowgill2017-12-09
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In commit 061a0c14bb57 ("decode: restructure the core decoding code"), the deprecated avcodec_decode_* APIs were reworked so that they called into the new avcodec_send_packet / avcodec_receive_frame API. This had the side effect of prohibiting sending new packets containing data after a drain packet, but in previous versions of FFmpeg this "worked" and some applications relied on it. To restore some compatibility, reset the codec if we receive a new non-drain packet using the old API after draining has completed. While this does not give the same behaviour as the old API did, in the majority of cases it works and it does not require changes to any other part of the decoding code. Fixes ticket #6775 Signed-off-by: James Cowgill <jcowgill@debian.org> Signed-off-by: Marton Balint <cus@passwd.hu>
* | lavc: Mark all AVHWAccel structures as constMark Thompson2017-11-26
| |
* | lavc: Use hardware config information in ff_get_format()Mark Thompson2017-11-26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This removes the dependency that hardware pixel formats previously had on AVHWAccel instances, meaning only those which actually do something need exist after this patch. Also updates avcodec_default_get_format() to be able to choose hardware formats if either a matching device has been supplied or no additional external configuration is required, and avcodec_get_hw_frames_parameters() to use the hardware config rather than searching the old hwaccel list. The FF_CODEC_CAP_HWACCEL_REQUIRE_CLASS mechanism is deleted because it no longer does anything (the codec already contains the pointers to the matching hwaccels).
* | Merge commit 'b46a77f19ddc4b2b5fa3187835ceb602a5244e24'James Almer2017-11-11
|\| | | | | | | | | | | | | | | | | * commit 'b46a77f19ddc4b2b5fa3187835ceb602a5244e24': lavc: external hardware frame pool initialization Includes the fix from e724bdfffbd3c27aac53d1f32f20f105f37caef0 Merged-by: James Almer <jamrial@gmail.com>
| * lavc: external hardware frame pool initializationwm42017-10-19
| | | | | | | | | | | | | | | | | | | | | | | | This adds a new API, which allows the API user to query the required AVHWFramesContext parameters. This also reduces code duplication across the hwaccels by introducing ff_decode_get_hw_frames_ctx(), which uses the new API function. It takes care of initializing the hw_frames_ctx if needed, and does additional error handling and API usage checking. Support for VDA and Cuvid missing. Signed-off-by: Anton Khirnov <anton@khirnov.net>
| * decode: add a per-frame private data for hwaccel useAnton Khirnov2017-07-26
| | | | | | | | | | | | This will be useful in the CUVID hwaccel. It should also eventually replace current decoder-specific mechanisms used by various other hwaccels.
| * decode: add a mechanism for performing delayed processing on the decoded framesAnton Khirnov2017-07-26
| | | | | | | | This will be useful in the CUVID hwaccel.
| * decode: add a method for attaching lavc-internal data to framesAnton Khirnov2017-07-26
| | | | | | | | | | | | | | | | Use the AVFrame.opaque_ref field. The original user's opaque_ref is wrapped in the lavc struct and then unwrapped before the frame is returned to the caller. This new struct will be useful in the following commits.
| * decode: avoid leaks on failure in ff_get_buffer()Anton Khirnov2017-07-26
| | | | | | | | | | | | | | If the get_buffer() call fails, the frame might have some side data already set. Make sure it gets freed. CC: libav-stable@libav.org
| * lavc, lavu: move frame cropping to a convenience functionwm42017-07-26
| | | | | | | | Signed-off-by: Anton Khirnov <anton@khirnov.net>
| * hwframe: Allow hwaccel frame allocators to align surface sizesAnton Khirnov2017-06-27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Hardware accelerated decoding generally uses AVHWFramesContext for pool allocation of hardware surfaces. These are setup to allocate surfaces aligned to hardware and hwaccel API requirements. Due to the architecture, av_hwframe_get_buffer() will return AVFrames with the dimensions set to the aligned sizes. This causes some decoders (like hevc) return these aligned size as final frame size, instead of cropping them to the video's actual dimensions. To make sure this doesn't happen, crop the frame to the size the decoder expects when ff_get_buffer() is called. Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
| * lavc: set avctx->hwaccel before initwm42017-06-08
| | | | | | | | | | | | | | | | | | So a hwaccel can access avctx->hwaccel in init for whatever reason. This is for the new d3d hwaccel API. We could create separate entrypoints for each of the 3 hwaccel types (dxva2, d3d11va, new d3d11va), but this seems nicer. Signed-off-by: Diego Biurrun <diego@biurrun.de>
| * decode: fix the code reducing cropping to preserve alignmentAnton Khirnov2017-05-20
| | | | | | | | | | | | Currently it does not work at all. Bug-Id: 1058
| * decode: Initialize ret before using itVittorio Giovara2017-04-10
| | | | | | | | | | libavcodec/decode.c:608:9: warning: variable 'ret' is used uninitialized whenever 'if' condition is false
| * lavc: Drop deprecated time_base variable for decodingVittorio Giovara2017-03-23
| | | | | | | | Deprecated in 10/2015.
* | avcodec/decode: always free private_refTimo Rothenpieler2017-11-11
| | | | | | | | | | | | There is no reason to keep this intact when decoding failed, specially as private_ref is supposed to always be NULL when a frame is returned to the user.
* | avcodec/decode: add missing \n to log messagewm42017-11-10
| |
* | avcodec: allow multiple hwaccels for the same codec/pixfmtwm42017-11-10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, AVHWAccels are looked up using a (codec_id, pixfmt) tuple. This means it's impossible to have 2 decoders for the same codec and using the same opaque hardware pixel format. This breaks merging Libav's CUVID hwaccel. FFmpeg has its own CUVID support, but it's a full stream decoder, using NVIDIA's codec parser. The Libav one is a true hwaccel, which is based on the builtin software decoders. Fix this by introducing another field to disambiguate AVHWAccels, and use it for our CUVID decoders. FF_CODEC_CAP_HWACCEL_REQUIRE_CLASS makes this mechanism backwards compatible and optional.
* | decode: add a per-frame private data for hwaccel useAnton Khirnov2017-11-10
| | | | | | | | | | | | | | | | This will be useful in the CUVID hwaccel. It should also eventually replace current decoder-specific mechanisms used by various other hwaccels. Merges Libav commit 704311b2946d74a80f65906961cd9baaa18683a3.
* | decode: add a mechanism for performing delayed processing on the decoded framesAnton Khirnov2017-11-10
| | | | | | | | | | | | This will be useful in the CUVID hwaccel. Merges Libav commit badf0951f54c1332e77455dc40398f3512540c1b.
* | decode: add a method for attaching lavc-internal data to framesAnton Khirnov2017-11-10
| | | | | | | | | | | | | | | | Use the AVFrame.private_ref field. This new struct will be useful in the following commits. Merges Libav commit 359a8a3e2d1194b52b6c386f94fd0929567dfb67.
* | decode: avoid leaks on failure in ff_get_buffer()Anton Khirnov2017-10-29
| | | | | | | | | | | | | | | | | | If the get_buffer() call fails, the frame might have some side data already set. Make sure it gets freed. Merges Libav commit de77671438c24ffea93398c8dc885d4dd04477de. Signed-off-by: James Almer <jamrial@gmail.com>
* | avcodec: remove ABI portion of the side data merging APIJames Almer2017-10-22
| | | | | | | | | | | | The actual API is left in place until the deprecation period ends. Signed-off-by: James Almer <jamrial@gmail.com>
* | Merge commit '7b917041184874e7d7cba4450813de7e0bb28a33'James Almer2017-10-21
|\| | | | | | | | | | | | | * commit '7b917041184874e7d7cba4450813de7e0bb28a33': lavc: Drop deprecated VDPAU codec capability Merged-by: James Almer <jamrial@gmail.com>
* | avcodec/decode: Pass on the Closed Captions Side DataKarthick J2017-09-28
| | | | | | | | | | Signed-off-by: Karthick J <kjeyapal@akamai.com> Signed-off-by: Marton Balint <cus@passwd.hu>
* | avcodec: add AV_HWACCEL_CODEC_CAP_EXPERIMENTAL flagJames Almer2017-09-04
| | | | | | | | | | | | | | | | This flag replaces the deprecated, non-prefixed HWACCEL_CODEC_CAP_EXPERIMENTAL one. Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: James Almer <jamrial@gmail.com>
* | lavc, lavu: move frame cropping to a convenience functionwm42017-08-08
| | | | | | | | | | | | Signed-off-by: Anton Khirnov <anton@khirnov.net> Merged from Libav commit 47399ccdfd.
* | hwframe: Allow hwaccel frame allocators to align surface sizesAnton Khirnov2017-06-27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Hardware accelerated decoding generally uses AVHWFramesContext for pool allocation of hardware surfaces. These are setup to allocate surfaces aligned to hardware and hwaccel API requirements. Due to the architecture, av_hwframe_get_buffer() will return AVFrames with the dimensions set to the aligned sizes. This causes some decoders (like hevc) return these aligned size as final frame size, instead of cropping them to the video's actual dimensions. To make sure this doesn't happen, crop the frame to the size the decoder expects when ff_get_buffer() is called. Merges Libav commit 3fdf50f9e864c88da2139cf066832944de81acaa. Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
* | lavc: set avctx->hwaccel before initwm42017-06-27
| | | | | | | | | | | | | | | | | | | | | | So a hwaccel can access avctx->hwaccel in init for whatever reason. This is for the new d3d hwaccel API. We could create separate entrypoints for each of the 3 hwaccel types (dxva2, d3d11va, new d3d11va), but this seems nicer. Merges Libav commit bd747b9226414007f0207fa201976af7217e3b77. Signed-off-by: Diego Biurrun <diego@biurrun.de>
* | avcodec/decode: Update decode_simple_internal() to get the side data correctly.John Rummell2017-06-20
| | | | | | | | | | | | | | | | Use avci->last_pkt_props to get the side data. Using |pkt| doesn't work when FF_API_MERGE_SD is set, as the compressed side data is expanded into |tmp|, leaving the original |pkt| unchanged. Signed-off-by: James Almer <jamrial@gmail.com>
* | avcodec/decode: fix function nameJames Almer2017-05-20
| |
* | decode: fix the code reducing cropping to preserve alignmentAnton Khirnov2017-05-20
| | | | | | | | | | | | | | Currently it does not work at all. Libav Bug-Id: 1058 (cherry picked from commit 8652a2c24836ce5546b398f12b7fed45000050e1)
* | Merge commit '019ab88a95cb31b698506d90e8ce56695a7f1cc5'James Almer2017-05-08
|\| | | | | | | | | | | | | * commit '019ab88a95cb31b698506d90e8ce56695a7f1cc5': lavc: add an option for exporting cropping information to the caller Merged-by: James Almer <jamrial@gmail.com>
| * lavc: add an option for exporting cropping information to the callerAnton Khirnov2017-01-12
| | | | | | | | | | Also, add generic code for handling cropping, so the decoders can export just the cropping size and not bother with the rest.
* | avcodec: Avoid splitting side data repeatedlyMichael Niedermayer2017-05-06
| | | | | | | | | | | | | | | | Fixes Timeout Fixes: 508/clusterfuzz-testcase-6245747678773248 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avcodec/decode: also check for FF_CODEC_CAP_SETS_PKT_DTS in audio decodersJames Almer2017-05-02
| | | | | | | | | | Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: James Almer <jamrial@gmail.com>
* | avcodec/decode: do not treat discarded frames as eof when drainingMuhammad Faiz2017-05-03
| | | | | | | | | | | | | | | | Fix fate failures: make fate-mov THREADS=32 Reviewed-by: wm4 <nfxjfg@googlemail.com> Signed-off-by: Muhammad Faiz <mfcc64@gmail.com>
* | avcodec/pthread_frame, decode: allow errors to happen on drainingMuhammad Faiz2017-04-30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | So, all frames and errors are correctly reported in order. Also limit the numbers of error during draining to prevent infinite loop. This fix fate failure with THREADS>=4: make fate-h264-attachment-631 THREADS=4 This also reverts a755b725ec1d657609c8bd726ce37e7cf193d03f. Suggested-by: wm4, Ronald S. Bultje, Marton Balint Reviewed-by: w4 <nfxjfg@googlemail.com> Reviewed-by: Ronald S. Bultje <rsbultje@gmail.com> Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: Muhammad Faiz <mfcc64@gmail.com>
* | decode: Initialize ret before using itVittorio Giovara2017-04-23
| | | | | | | | | | | | | | libavcodec/decode.c:608:9: warning: variable 'ret' is used uninitialized whenever 'if' condition is false (cherry picked from libav commit efddf2c09aed7400c73ecf327f86a4d0452b94b5)
* | avcodec/decode: also update consumed bytes on last_pkt_props->sizeJames Almer2017-04-23
| |
* | avcodec: do not use AVFrame accessorMuhammad Faiz2017-04-23
| | | | | | | | | | Reviewed-by: wm4 <nfxjfg@googlemail.com> Signed-off-by: Muhammad Faiz <mfcc64@gmail.com>