summaryrefslogtreecommitdiff
path: root/libavcodec/v4l2_m2m.c
Commit message (Collapse)AuthorAge
* avcodec/v4l2_m2m: Check if the file descriptor is valid before closingWujian(Chin)2022-07-01
| | | | | | | Fixes ticket #9507. Reviewed-by: Steven Liu <liuqi05@kuaishou.com> Signed-off-by: wujian_nanjing <wujian2@huawei.com>
* avcodec/v4l2_m2m: Remove unused ff_v4l2_m2m_codec_full_reinitAndreas Rheinhardt2022-06-11
| | | | | | Unused since df701ed0b582a6b5c763310b4225446089cbcfb1. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec, avformat: Remove unnecessary inclusions of lavc/internal.hAndreas Rheinhardt2022-03-23
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/v4l2_m2m_enc: buffer frame if it cannot be enqueuedAndriy Gelman2020-08-23
| | | | | | | | | Currently if the frame buffers are full, the frame is unrefed and dropped. Instead buffer the frame so that it is enqueued in the next v4l2_receive_packet() call. The behavior was observed on DragonBoard 410c. Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
* avcodec/v4l2_m2m: reindent after last commitAndriy Gelman2020-08-02
| | | | Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
* avcodec/v4l2_m2m: adapt to call close() on init failAndriy Gelman2020-08-02
| | | | | | | | This fixes several mem leaks when init of encoder/decoder failed. Fixes ticket #8285 Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
* avcodec/encode: restructure the core encoding codeJames Almer2020-06-18
| | | | | | | | | | | | | | | | This commit follows the same logic as 061a0c14bb, but for the encode API: The new public encoding API will no longer be a wrapper around the old deprecated one, and the internal API used by the encoders now consists of a single receive_packet() callback that pulls frames as required. amf encoders adapted by James Almer librav1e encoder adapted by James Almer nvidia encoders adapted by James Almer MediaFoundation encoders adapted by James Almer vaapi encoders adapted by Linjie Fu v4l2_m2m encoders adapted by Andriy Gelman Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/v4l2_m2m: Avoid using intermediate bufferAndreas Rheinhardt2020-03-10
| | | | | | | | | | | | | | | | | Up until now, v4l2_m2m would write via snprintf() into an intermediate buffer and then copy from there (via strncpy()) to the end buffer. This commit changes this by removing the intermediate buffer. The call to strncpy() was actually of the form strncpy(dst, src, strlen(src) + 1) which is unsafe in general, but safe in this instance because dst and src were both of the same size and src was a proper zero-terminated string. But this nevertheless led to a compiler warning "‘strncpy’ specified bound depends on the length of the source argument [-Wstringop-overflow=]" in GCC 9.2. strlen() was unnecessary anyway. Reviewed-by: Andriy Gelman <andriy.gelman@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/v4l2_m2m: Fix typo in log message and cosmeticsAndriy Gelman2020-02-16
| | | | Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
* avcodec/v4l2_m2m: CosmeticsAndriy Gelman2020-02-01
| | | | | | Change pointer symbol position. Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
* avcodec/v4l2_m2m: Use consistent logging contextAndriy Gelman2020-02-01
| | | | | | | Before this commit v4l2_m2m used two different logging contexts (from V4L2m2mPriv and AVCodecContext). For consistency always use AVCodecContext. Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
* avcodec/v4l2_m2m: Simplify capture buffer init checkAndriy Gelman2020-02-01
| | | | | | | | Before this commit s->avctx == NULL was used to infer that an encoder is being initialzed. Code readability has been improved by directly using !av_codec_is_decoder() instead. Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
* avcodec/v4l2_m2m: Fix indentationAndriy Gelman2019-11-01
| | | | Signed-off-by: Aman Gupta <aman@tmm1.net>
* avcodec/v4l2_m2m: decouple v4l2_m2m helpers from AVCodecContextAman Gupta2019-09-10
| | | | | | This will allow re-use of the m2m backend with AVFilterContext Signed-off-by: Aman Gupta <aman@tmm1.net>
* avcodec/v4l2_m2m: fix av_pix_fmt changing when multiple /dev/video* devices ↵Aman Gupta2019-09-10
| | | | | | | | | | | | are probed On the RPI, three different /dev/video devices exist (decoder, scaler, encoder). When probing the devices in order, the originally requested pix fmt would be mutated causing the wrong one to be chosen when a matching device was finally found. Signed-off-by: Aman Gupta <aman@tmm1.net>
* avcodec/v4l2_m2m: disable info logging during device probeAman Gupta2019-09-10
| | | | Signed-off-by: Aman Gupta <aman@tmm1.net>
* avcodec/v4l2_m2m: fix minor indentation issueAman Gupta2019-09-02
|
* avcodec/v4l2_m2m: use log_ctx variable consistentlyAman Gupta2019-09-02
| | | | Signed-off-by: Aman Gupta <aman@tmm1.net>
* avcodec/v4l2_m2m: log planar mode used by driverAman Gupta2019-09-02
| | | | Signed-off-by: Aman Gupta <aman@tmm1.net>
* avcodec/v4l2_m2m: remove trailing whitespace in output identifierAman Gupta2019-09-02
| | | | Signed-off-by: Aman Gupta <aman@tmm1.net>
* avcodec/v4l2_m2m: log requested pixel formatsAman Gupta2019-09-02
| | | | Signed-off-by: Aman Gupta <aman@tmm1.net>
* lavc/v4l2_m2m: don't close the file descriptor we don't ownPavel Koshevoy2019-09-02
| | | | | | | | | ff_v4l2_m2m_create_context initialized V4L2m2mContext.fd to 0 which is a valid file descriptor value. Next ff_v4l2_m2m_codec_init failed and v4l2_m2m_destroy_context closed file descriptor 0 even though it didn't belong to V4L2m2mContext. Signed-off-by: Pavel Koshevoy <pkoshevoy@gmail.com>
* v4l2_m2m: Fix free of the wrong pointer in an error pathMark Thompson2018-01-21
| | | | Fixes CIDs #1427821 and #1427822.
* avcodec: v4l2_m2m: fix races around freeing data on closeMark Thompson2018-01-21
| | | | | | | | Refcount all of the context information. This also fixes a potential segmentation fault when accessing freed memory (buffer returned after the codec has been closed). Tested-by: Jorge Ramirez-Ortiz <jorge.ramirez.ortiz@gmail.com>
* libavcodec: v4l2: add support for v4l2 mem2mem codecsJorge Ramirez-Ortiz2017-09-23
This patchset enhances Alexis Ballier's original patch and validates it using Qualcomm's Venus hardware (driver recently landed upstream [1]). This has been tested on Qualcomm's DragonBoard 410c and 820c Configure/make scripts have been validated on Ubuntu 10.04 and 16.04. Tested decoders: - h264 - h263 - mpeg4 - vp8 - vp9 - hevc Tested encoders: - h264 - h263 - mpeg4 Tested transcoding (concurrent encoding/decoding) Some of the changes introduced: - v4l2: code cleanup and abstractions added - v4l2: follow the new encode/decode api. - v4l2: fix display size for NV12 output pool. - v4l2: handle EOS (EPIPE and draining) - v4l2: vp8 and mpeg4 decoding and encoding. - v4l2: hevc and vp9 support. - v4l2: generate EOF on dequeue errors. - v4l2: h264_mp4toannexb filtering. - v4l2: fixed make install and fate issues. - v4l2: codecs enabled/disabled depending on pixfmt defined - v4l2: pass timebase/framerate to the context - v4l2: runtime decoder reconfiguration. - v4l2: add more frame information - v4l2: free hardware resources on last reference being released - v4l2: encoding: disable b-frames for upstreaming (patch required) [1] https://lwn.net/Articles/697956/ System Level view: v42l_m2m_enc/dec --> v4l2_m2m --> v4l2_context --> v4l2_buffers Reviewed-by: Jorge Ramirez <jorge.ramirez-ortiz@linaro.org> Reviewed-by: Alexis Ballier <aballier@gentoo.org> Tested-by: Jorge Ramirez <jorge.ramirez-ortiz@linaro.org> Signed-off-by: wm4 <nfxjfg@googlemail.com>