mirror of
https://github.com/LibreELEC/LibreELEC.tv.git
synced 2025-08-05 17:07:49 +00:00
ffmpeg: update rpi patch
Patch created using revisions f719f86..0941f5c from branch test/4.3.2/rpi_main of https://github.com/jc-kynesim/rpi-ffmpeg
This commit is contained in:
parent
3351d8acd5
commit
c937bea754
@ -1,16 +1,24 @@
|
|||||||
diff --git a/configure b/configure
|
diff --git a/configure b/configure
|
||||||
index 36713ab658..665d247bf7 100755
|
index 36713ab658..618d1a63ef 100755
|
||||||
--- a/configure
|
--- a/configure
|
||||||
+++ b/configure
|
+++ b/configure
|
||||||
@@ -274,6 +274,7 @@ External library support:
|
@@ -207,6 +207,7 @@ External library support:
|
||||||
|
--disable-bzlib disable bzlib [autodetect]
|
||||||
|
--disable-coreimage disable Apple CoreImage framework [autodetect]
|
||||||
|
--enable-chromaprint enable audio fingerprinting with chromaprint [no]
|
||||||
|
+ --disable-epoxy disable epoxy [autodetect]
|
||||||
|
--enable-frei0r enable frei0r video filtering [no]
|
||||||
|
--enable-gcrypt enable gcrypt, needed for rtmp(t)e support
|
||||||
|
if openssl, librtmp or gmp is not used [no]
|
||||||
|
@@ -274,6 +275,7 @@ External library support:
|
||||||
--enable-libtls enable LibreSSL (via libtls), needed for https support
|
--enable-libtls enable LibreSSL (via libtls), needed for https support
|
||||||
if openssl, gnutls or mbedtls is not used [no]
|
if openssl, gnutls or mbedtls is not used [no]
|
||||||
--enable-libtwolame enable MP2 encoding via libtwolame [no]
|
--enable-libtwolame enable MP2 encoding via libtwolame [no]
|
||||||
+ --enable-libudev enable libudev [no]
|
+ --disable-libudev disable libudev [autodetect]
|
||||||
--enable-libv4l2 enable libv4l2/v4l-utils [no]
|
--enable-libv4l2 enable libv4l2/v4l-utils [no]
|
||||||
--enable-libvidstab enable video stabilization using vid.stab [no]
|
--enable-libvidstab enable video stabilization using vid.stab [no]
|
||||||
--enable-libvmaf enable vmaf filter via libvmaf [no]
|
--enable-libvmaf enable vmaf filter via libvmaf [no]
|
||||||
@@ -336,12 +337,17 @@ External library support:
|
@@ -336,12 +338,17 @@ External library support:
|
||||||
--enable-libmfx enable Intel MediaSDK (AKA Quick Sync Video) code via libmfx [no]
|
--enable-libmfx enable Intel MediaSDK (AKA Quick Sync Video) code via libmfx [no]
|
||||||
--enable-libnpp enable Nvidia Performance Primitives-based code [no]
|
--enable-libnpp enable Nvidia Performance Primitives-based code [no]
|
||||||
--enable-mmal enable Broadcom Multi-Media Abstraction Layer (Raspberry Pi) via MMAL [no]
|
--enable-mmal enable Broadcom Multi-Media Abstraction Layer (Raspberry Pi) via MMAL [no]
|
||||||
@ -28,23 +36,17 @@ index 36713ab658..665d247bf7 100755
|
|||||||
--disable-vaapi disable Video Acceleration API (mainly Unix/Intel) code [autodetect]
|
--disable-vaapi disable Video Acceleration API (mainly Unix/Intel) code [autodetect]
|
||||||
--disable-vdpau disable Nvidia Video Decode and Presentation API for Unix code [autodetect]
|
--disable-vdpau disable Nvidia Video Decode and Presentation API for Unix code [autodetect]
|
||||||
--disable-videotoolbox disable VideoToolbox code [autodetect]
|
--disable-videotoolbox disable VideoToolbox code [autodetect]
|
||||||
@@ -1771,6 +1777,7 @@ EXTERNAL_LIBRARY_LIST="
|
@@ -1699,7 +1706,9 @@ EXTERNAL_AUTODETECT_LIBRARY_LIST="
|
||||||
libdav1d
|
avfoundation
|
||||||
libdc1394
|
bzlib
|
||||||
libdrm
|
coreimage
|
||||||
+ epoxy
|
+ epoxy
|
||||||
libflite
|
iconv
|
||||||
libfontconfig
|
|
||||||
libfreetype
|
|
||||||
@@ -1807,6 +1814,7 @@ EXTERNAL_LIBRARY_LIST="
|
|
||||||
libtesseract
|
|
||||||
libtheora
|
|
||||||
libtwolame
|
|
||||||
+ libudev
|
+ libudev
|
||||||
libv4l2
|
libxcb
|
||||||
libvorbis
|
libxcb_shm
|
||||||
libvpx
|
libxcb_shape
|
||||||
@@ -1861,7 +1869,10 @@ HWACCEL_LIBRARY_LIST="
|
@@ -1861,7 +1870,10 @@ HWACCEL_LIBRARY_LIST="
|
||||||
mmal
|
mmal
|
||||||
omx
|
omx
|
||||||
opencl
|
opencl
|
||||||
@ -55,7 +57,7 @@ index 36713ab658..665d247bf7 100755
|
|||||||
"
|
"
|
||||||
|
|
||||||
DOCUMENT_LIST="
|
DOCUMENT_LIST="
|
||||||
@@ -1877,12 +1888,16 @@ FEATURE_LIST="
|
@@ -1877,12 +1889,16 @@ FEATURE_LIST="
|
||||||
gray
|
gray
|
||||||
hardcoded_tables
|
hardcoded_tables
|
||||||
omx_rpi
|
omx_rpi
|
||||||
@ -72,7 +74,7 @@ index 36713ab658..665d247bf7 100755
|
|||||||
"
|
"
|
||||||
|
|
||||||
# this list should be kept in linking order
|
# this list should be kept in linking order
|
||||||
@@ -1923,6 +1938,7 @@ SUBSYSTEM_LIST="
|
@@ -1923,6 +1939,7 @@ SUBSYSTEM_LIST="
|
||||||
pixelutils
|
pixelutils
|
||||||
network
|
network
|
||||||
rdft
|
rdft
|
||||||
@ -80,7 +82,7 @@ index 36713ab658..665d247bf7 100755
|
|||||||
"
|
"
|
||||||
|
|
||||||
# COMPONENT_LIST needs to come last to ensure correct dependency checking
|
# COMPONENT_LIST needs to come last to ensure correct dependency checking
|
||||||
@@ -2405,9 +2421,11 @@ CONFIG_EXTRA="
|
@@ -2405,9 +2422,11 @@ CONFIG_EXTRA="
|
||||||
rangecoder
|
rangecoder
|
||||||
riffdec
|
riffdec
|
||||||
riffenc
|
riffenc
|
||||||
@ -92,7 +94,7 @@ index 36713ab658..665d247bf7 100755
|
|||||||
scene_sad
|
scene_sad
|
||||||
sinewin
|
sinewin
|
||||||
snappy
|
snappy
|
||||||
@@ -2737,6 +2755,8 @@ hap_decoder_select="snappy texturedsp"
|
@@ -2737,6 +2756,8 @@ hap_decoder_select="snappy texturedsp"
|
||||||
hap_encoder_deps="libsnappy"
|
hap_encoder_deps="libsnappy"
|
||||||
hap_encoder_select="texturedspenc"
|
hap_encoder_select="texturedspenc"
|
||||||
hevc_decoder_select="bswapdsp cabac golomb hevcparse videodsp"
|
hevc_decoder_select="bswapdsp cabac golomb hevcparse videodsp"
|
||||||
@ -101,7 +103,7 @@ index 36713ab658..665d247bf7 100755
|
|||||||
huffyuv_decoder_select="bswapdsp huffyuvdsp llviddsp"
|
huffyuv_decoder_select="bswapdsp huffyuvdsp llviddsp"
|
||||||
huffyuv_encoder_select="bswapdsp huffman huffyuvencdsp llvidencdsp"
|
huffyuv_encoder_select="bswapdsp huffman huffyuvencdsp llvidencdsp"
|
||||||
hymt_decoder_select="huffyuv_decoder"
|
hymt_decoder_select="huffyuv_decoder"
|
||||||
@@ -2903,6 +2923,7 @@ d3d11va_deps="dxva_h ID3D11VideoDecoder ID3D11VideoContext"
|
@@ -2903,6 +2924,7 @@ d3d11va_deps="dxva_h ID3D11VideoDecoder ID3D11VideoContext"
|
||||||
dxva2_deps="dxva2api_h DXVA2_ConfigPictureDecode ole32 user32"
|
dxva2_deps="dxva2api_h DXVA2_ConfigPictureDecode ole32 user32"
|
||||||
ffnvcodec_deps_any="libdl LoadLibrary"
|
ffnvcodec_deps_any="libdl LoadLibrary"
|
||||||
nvdec_deps="ffnvcodec"
|
nvdec_deps="ffnvcodec"
|
||||||
@ -109,7 +111,7 @@ index 36713ab658..665d247bf7 100755
|
|||||||
vaapi_x11_deps="xlib"
|
vaapi_x11_deps="xlib"
|
||||||
videotoolbox_hwaccel_deps="videotoolbox pthreads"
|
videotoolbox_hwaccel_deps="videotoolbox pthreads"
|
||||||
videotoolbox_hwaccel_extralibs="-framework QuartzCore"
|
videotoolbox_hwaccel_extralibs="-framework QuartzCore"
|
||||||
@@ -2934,6 +2955,12 @@ hevc_dxva2_hwaccel_deps="dxva2 DXVA_PicParams_HEVC"
|
@@ -2934,6 +2956,12 @@ hevc_dxva2_hwaccel_deps="dxva2 DXVA_PicParams_HEVC"
|
||||||
hevc_dxva2_hwaccel_select="hevc_decoder"
|
hevc_dxva2_hwaccel_select="hevc_decoder"
|
||||||
hevc_nvdec_hwaccel_deps="nvdec"
|
hevc_nvdec_hwaccel_deps="nvdec"
|
||||||
hevc_nvdec_hwaccel_select="hevc_decoder"
|
hevc_nvdec_hwaccel_select="hevc_decoder"
|
||||||
@ -122,16 +124,15 @@ index 36713ab658..665d247bf7 100755
|
|||||||
hevc_vaapi_hwaccel_deps="vaapi VAPictureParameterBufferHEVC"
|
hevc_vaapi_hwaccel_deps="vaapi VAPictureParameterBufferHEVC"
|
||||||
hevc_vaapi_hwaccel_select="hevc_decoder"
|
hevc_vaapi_hwaccel_select="hevc_decoder"
|
||||||
hevc_vdpau_hwaccel_deps="vdpau VdpPictureInfoHEVC"
|
hevc_vdpau_hwaccel_deps="vdpau VdpPictureInfoHEVC"
|
||||||
@@ -3401,8 +3428,14 @@ sndio_indev_deps="sndio"
|
@@ -3401,8 +3429,13 @@ sndio_indev_deps="sndio"
|
||||||
sndio_outdev_deps="sndio"
|
sndio_outdev_deps="sndio"
|
||||||
v4l2_indev_deps_any="linux_videodev2_h sys_videoio_h"
|
v4l2_indev_deps_any="linux_videodev2_h sys_videoio_h"
|
||||||
v4l2_indev_suggest="libv4l2"
|
v4l2_indev_suggest="libv4l2"
|
||||||
+v4l2_outdev_deps="libdrm"
|
+v4l2_outdev_deps="libdrm"
|
||||||
v4l2_outdev_deps_any="linux_videodev2_h sys_videoio_h"
|
v4l2_outdev_deps_any="linux_videodev2_h sys_videoio_h"
|
||||||
v4l2_outdev_suggest="libv4l2"
|
v4l2_outdev_suggest="libv4l2"
|
||||||
+vout_drm_outdev_deps="libdrm vout_drm"
|
+vout_drm_outdev_deps="libdrm"
|
||||||
+vout_egl_outdev_deps="xlib"
|
+vout_egl_outdev_deps="xlib epoxy"
|
||||||
+vout_egl_outdev_select="epoxy"
|
|
||||||
+vout_rpi_outdev_deps="rpi"
|
+vout_rpi_outdev_deps="rpi"
|
||||||
+vout_rpi_outdev_select="sand"
|
+vout_rpi_outdev_select="sand"
|
||||||
vfwcap_indev_deps="vfw32 vfwcap_defines"
|
vfwcap_indev_deps="vfw32 vfwcap_defines"
|
||||||
@ -145,23 +146,20 @@ index 36713ab658..665d247bf7 100755
|
|||||||
unsharp_opencl_filter_deps="opencl"
|
unsharp_opencl_filter_deps="opencl"
|
||||||
uspp_filter_deps="gpl avcodec"
|
uspp_filter_deps="gpl avcodec"
|
||||||
vaguedenoiser_filter_deps="gpl"
|
vaguedenoiser_filter_deps="gpl"
|
||||||
@@ -6299,6 +6333,7 @@ enabled libdav1d && require_pkg_config libdav1d "dav1d >= 0.4.0" "dav1d
|
@@ -6102,6 +6136,12 @@ check_func_headers glob.h glob
|
||||||
enabled libdavs2 && require_pkg_config libdavs2 "davs2 >= 1.6.0" davs2.h davs2_decoder_open
|
enabled xlib &&
|
||||||
enabled libdc1394 && require_pkg_config libdc1394 libdc1394-2 dc1394/dc1394.h dc1394_new
|
check_lib xlib "X11/Xlib.h X11/extensions/Xvlib.h" XvGetPortAttribute -lXv -lX11 -lXext
|
||||||
enabled libdrm && require_pkg_config libdrm libdrm xf86drm.h drmGetVersion
|
|
||||||
+enabled epoxy && require_pkg_config epoxy epoxy epoxy/egl.h epoxy_egl_version
|
+enabled libudev &&
|
||||||
enabled libfdk_aac && { check_pkg_config libfdk_aac fdk-aac "fdk-aac/aacenc_lib.h" aacEncOpen ||
|
+ check_pkg_config libudev libudev libudev.h udev_new
|
||||||
{ require libfdk_aac fdk-aac/aacenc_lib.h aacEncOpen -lfdk-aac &&
|
+
|
||||||
warn "using libfdk without pkg-config"; } }
|
+enabled epoxy &&
|
||||||
@@ -6376,6 +6411,7 @@ enabled libtls && require_pkg_config libtls libtls tls.h tls_configur
|
+ check_pkg_config epoxy epoxy epoxy/egl.h epoxy_egl_version
|
||||||
enabled libtwolame && require libtwolame twolame.h twolame_init -ltwolame &&
|
+
|
||||||
{ check_lib libtwolame twolame.h twolame_encode_buffer_float32_interleaved -ltwolame ||
|
check_headers direct.h
|
||||||
die "ERROR: libtwolame must be installed and version must be >= 0.3.10"; }
|
check_headers dirent.h
|
||||||
+enabled libudev && require_pkg_config libudev libudev libudev.h udev_new
|
check_headers dxgidebug.h
|
||||||
enabled libv4l2 && require_pkg_config libv4l2 libv4l2 libv4l2.h v4l2_ioctl
|
@@ -6430,11 +6470,12 @@ enabled mbedtls && { check_pkg_config mbedtls mbedtls mbedtls/x509_crt
|
||||||
enabled libvidstab && require_pkg_config libvidstab "vidstab >= 0.98" vid.stab/libvidstab.h vsMotionDetectInit
|
|
||||||
enabled libvmaf && require_pkg_config libvmaf "libvmaf >= 1.3.9" libvmaf.h compute_vmaf
|
|
||||||
@@ -6430,11 +6466,12 @@ enabled mbedtls && { check_pkg_config mbedtls mbedtls mbedtls/x509_crt
|
|
||||||
check_lib mbedtls mbedtls/ssl.h mbedtls_ssl_init -lmbedtls -lmbedx509 -lmbedcrypto ||
|
check_lib mbedtls mbedtls/ssl.h mbedtls_ssl_init -lmbedtls -lmbedx509 -lmbedcrypto ||
|
||||||
die "ERROR: mbedTLS not found"; }
|
die "ERROR: mbedTLS not found"; }
|
||||||
enabled mediacodec && { enabled jni || die "ERROR: mediacodec requires --enable-jni"; }
|
enabled mediacodec && { enabled jni || die "ERROR: mediacodec requires --enable-jni"; }
|
||||||
@ -176,18 +174,24 @@ index 36713ab658..665d247bf7 100755
|
|||||||
die "ERROR: mmal not found" &&
|
die "ERROR: mmal not found" &&
|
||||||
check_func_headers interface/mmal/mmal.h "MMAL_PARAMETER_VIDEO_MAX_NUM_CALLBACKS"; }
|
check_func_headers interface/mmal/mmal.h "MMAL_PARAMETER_VIDEO_MAX_NUM_CALLBACKS"; }
|
||||||
enabled openal && { { for al_extralibs in "${OPENAL_LIBS}" "-lopenal" "-lOpenAL32"; do
|
enabled openal && { { for al_extralibs in "${OPENAL_LIBS}" "-lopenal" "-lOpenAL32"; do
|
||||||
@@ -6475,6 +6512,10 @@ enabled rkmpp && { require_pkg_config rkmpp rockchip_mpp rockchip/r
|
@@ -6475,8 +6516,16 @@ enabled rkmpp && { require_pkg_config rkmpp rockchip_mpp rockchip/r
|
||||||
{ enabled libdrm ||
|
{ enabled libdrm ||
|
||||||
die "ERROR: rkmpp requires --enable-libdrm"; }
|
die "ERROR: rkmpp requires --enable-libdrm"; }
|
||||||
}
|
}
|
||||||
+enabled v4l2_request && { enabled libdrm ||
|
+enabled v4l2_request && { enabled libdrm ||
|
||||||
+ die "ERROR: v4l2-request requires --enable-libdrm"; } &&
|
+ die "ERROR: v4l2-request requires --enable-libdrm"; } &&
|
||||||
+ { enabled libudev ||
|
+ { enabled libudev ||
|
||||||
+ die "ERROR: v4l2-request requires --enable-libudev"; }
|
+ die "ERROR: v4l2-request requires libudev"; }
|
||||||
enabled vapoursynth && require_pkg_config vapoursynth "vapoursynth-script >= 42" VSScript.h vsscript_init
|
enabled vapoursynth && require_pkg_config vapoursynth "vapoursynth-script >= 42" VSScript.h vsscript_init
|
||||||
|
|
||||||
|
+enabled vout_drm && { enabled libdrm || die "ERROR: vout_drm requires --enable-libdrm"; }
|
||||||
|
+
|
||||||
|
+enabled vout_egl && { enabled epoxy || die "ERROR: vout_egl requires epoxy"; } &&
|
||||||
|
+ { enabled xlib || die "ERROR: vout_egl requires xlib"; }
|
||||||
|
|
||||||
@@ -6556,6 +6597,8 @@ if enabled v4l2_m2m; then
|
if enabled gcrypt; then
|
||||||
|
GCRYPT_CONFIG="${cross_prefix}libgcrypt-config"
|
||||||
|
@@ -6556,6 +6605,8 @@ if enabled v4l2_m2m; then
|
||||||
check_cc vp9_v4l2_m2m linux/videodev2.h "int i = V4L2_PIX_FMT_VP9;"
|
check_cc vp9_v4l2_m2m linux/videodev2.h "int i = V4L2_PIX_FMT_VP9;"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -50541,7 +50545,7 @@ index 8dbc7fc104..7d5fadcd3d 100644
|
|||||||
/**
|
/**
|
||||||
* Enqueues a V4L2Buffer
|
* Enqueues a V4L2Buffer
|
||||||
diff --git a/libavcodec/v4l2_context.c b/libavcodec/v4l2_context.c
|
diff --git a/libavcodec/v4l2_context.c b/libavcodec/v4l2_context.c
|
||||||
index 29b144ed73..ec7ad13be6 100644
|
index 29b144ed73..077c5223af 100644
|
||||||
--- a/libavcodec/v4l2_context.c
|
--- a/libavcodec/v4l2_context.c
|
||||||
+++ b/libavcodec/v4l2_context.c
|
+++ b/libavcodec/v4l2_context.c
|
||||||
@@ -27,11 +27,13 @@
|
@@ -27,11 +27,13 @@
|
||||||
@ -51276,7 +51280,7 @@ index 29b144ed73..ec7ad13be6 100644
|
|||||||
pixfmt = ff_v4l2_format_v4l2_to_avfmt(fdesc.pixelformat, AV_CODEC_ID_RAWVIDEO);
|
pixfmt = ff_v4l2_format_v4l2_to_avfmt(fdesc.pixelformat, AV_CODEC_ID_RAWVIDEO);
|
||||||
ret = v4l2_try_raw_format(ctx, pixfmt);
|
ret = v4l2_try_raw_format(ctx, pixfmt);
|
||||||
if (ret){
|
if (ret){
|
||||||
@@ -569,18 +722,84 @@ static int v4l2_get_coded_format(V4L2Context* ctx, uint32_t *p)
|
@@ -569,18 +722,83 @@ static int v4l2_get_coded_format(V4L2Context* ctx, uint32_t *p)
|
||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
@ -51323,22 +51327,25 @@ index 29b144ed73..ec7ad13be6 100644
|
|||||||
int ff_v4l2_context_set_status(V4L2Context* ctx, uint32_t cmd)
|
int ff_v4l2_context_set_status(V4L2Context* ctx, uint32_t cmd)
|
||||||
{
|
{
|
||||||
int type = ctx->type;
|
int type = ctx->type;
|
||||||
int ret;
|
- int ret;
|
||||||
|
+ int ret = 0;
|
||||||
+ AVCodecContext * const avctx = logger(ctx);
|
+ AVCodecContext * const avctx = logger(ctx);
|
||||||
+
|
|
||||||
|
- ret = ioctl(ctx_to_m2mctx(ctx)->fd, cmd, &type);
|
||||||
|
- if (ret < 0)
|
||||||
|
- return AVERROR(errno);
|
||||||
+ // Avoid doing anything if there is nothing we can do
|
+ // Avoid doing anything if there is nothing we can do
|
||||||
+ if (cmd == VIDIOC_STREAMOFF && !ctx_buffers_alloced(ctx) && !ctx->streamon)
|
+ if (cmd == VIDIOC_STREAMOFF && !ctx_buffers_alloced(ctx) && !ctx->streamon)
|
||||||
+ return 0;
|
+ return 0;
|
||||||
+
|
|
||||||
|
- ctx->streamon = (cmd == VIDIOC_STREAMON);
|
||||||
+ ff_mutex_lock(&ctx->lock);
|
+ ff_mutex_lock(&ctx->lock);
|
||||||
+
|
|
||||||
|
- return 0;
|
||||||
+ if (cmd == VIDIOC_STREAMON && !V4L2_TYPE_IS_OUTPUT(ctx->type))
|
+ if (cmd == VIDIOC_STREAMON && !V4L2_TYPE_IS_OUTPUT(ctx->type))
|
||||||
+ stuff_all_buffers(avctx, ctx);
|
+ stuff_all_buffers(avctx, ctx);
|
||||||
|
+
|
||||||
ret = ioctl(ctx_to_m2mctx(ctx)->fd, cmd, &type);
|
+ if (ioctl(ctx_to_m2mctx(ctx)->fd, cmd, &type) < 0) {
|
||||||
- if (ret < 0)
|
|
||||||
- return AVERROR(errno);
|
|
||||||
+ if (ret < 0) {
|
|
||||||
+ const int err = errno;
|
+ const int err = errno;
|
||||||
+ av_log(avctx, AV_LOG_ERROR, "%s set status %d (%s) failed: err=%d\n", ctx->name,
|
+ av_log(avctx, AV_LOG_ERROR, "%s set status %d (%s) failed: err=%d\n", ctx->name,
|
||||||
+ cmd, (cmd == VIDIOC_STREAMON) ? "ON" : "OFF", err);
|
+ cmd, (cmd == VIDIOC_STREAMON) ? "ON" : "OFF", err);
|
||||||
@ -51353,19 +51360,17 @@ index 29b144ed73..ec7ad13be6 100644
|
|||||||
+ av_log(avctx, AV_LOG_DEBUG, "%s set status %d (%s) OK\n", ctx->name,
|
+ av_log(avctx, AV_LOG_DEBUG, "%s set status %d (%s) OK\n", ctx->name,
|
||||||
+ cmd, (cmd == VIDIOC_STREAMON) ? "ON" : "OFF");
|
+ cmd, (cmd == VIDIOC_STREAMON) ? "ON" : "OFF");
|
||||||
+ }
|
+ }
|
||||||
|
+
|
||||||
- ctx->streamon = (cmd == VIDIOC_STREAMON);
|
|
||||||
+ // Both stream off & on effectively clear flag_last
|
+ // Both stream off & on effectively clear flag_last
|
||||||
+ ctx->flag_last = 0;
|
+ ctx->flag_last = 0;
|
||||||
|
+
|
||||||
- return 0;
|
|
||||||
+ ff_mutex_unlock(&ctx->lock);
|
+ ff_mutex_unlock(&ctx->lock);
|
||||||
+
|
+
|
||||||
+ return ret;
|
+ return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ff_v4l2_context_enqueue_frame(V4L2Context* ctx, const AVFrame* frame)
|
int ff_v4l2_context_enqueue_frame(V4L2Context* ctx, const AVFrame* frame)
|
||||||
@@ -608,7 +827,8 @@ int ff_v4l2_context_enqueue_frame(V4L2Context* ctx, const AVFrame* frame)
|
@@ -608,7 +826,8 @@ int ff_v4l2_context_enqueue_frame(V4L2Context* ctx, const AVFrame* frame)
|
||||||
return ff_v4l2_buffer_enqueue(avbuf);
|
return ff_v4l2_buffer_enqueue(avbuf);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -51375,7 +51380,7 @@ index 29b144ed73..ec7ad13be6 100644
|
|||||||
{
|
{
|
||||||
V4L2m2mContext *s = ctx_to_m2mctx(ctx);
|
V4L2m2mContext *s = ctx_to_m2mctx(ctx);
|
||||||
V4L2Buffer* avbuf;
|
V4L2Buffer* avbuf;
|
||||||
@@ -616,8 +836,9 @@ int ff_v4l2_context_enqueue_packet(V4L2Context* ctx, const AVPacket* pkt)
|
@@ -616,8 +835,9 @@ int ff_v4l2_context_enqueue_packet(V4L2Context* ctx, const AVPacket* pkt)
|
||||||
|
|
||||||
if (!pkt->size) {
|
if (!pkt->size) {
|
||||||
ret = v4l2_stop_decode(ctx);
|
ret = v4l2_stop_decode(ctx);
|
||||||
@ -51386,7 +51391,7 @@ index 29b144ed73..ec7ad13be6 100644
|
|||||||
s->draining = 1;
|
s->draining = 1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -626,8 +847,11 @@ int ff_v4l2_context_enqueue_packet(V4L2Context* ctx, const AVPacket* pkt)
|
@@ -626,8 +846,11 @@ int ff_v4l2_context_enqueue_packet(V4L2Context* ctx, const AVPacket* pkt)
|
||||||
if (!avbuf)
|
if (!avbuf)
|
||||||
return AVERROR(EAGAIN);
|
return AVERROR(EAGAIN);
|
||||||
|
|
||||||
@ -51400,7 +51405,7 @@ index 29b144ed73..ec7ad13be6 100644
|
|||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
return ff_v4l2_buffer_enqueue(avbuf);
|
return ff_v4l2_buffer_enqueue(avbuf);
|
||||||
@@ -636,19 +860,10 @@ int ff_v4l2_context_enqueue_packet(V4L2Context* ctx, const AVPacket* pkt)
|
@@ -636,19 +859,10 @@ int ff_v4l2_context_enqueue_packet(V4L2Context* ctx, const AVPacket* pkt)
|
||||||
int ff_v4l2_context_dequeue_frame(V4L2Context* ctx, AVFrame* frame, int timeout)
|
int ff_v4l2_context_dequeue_frame(V4L2Context* ctx, AVFrame* frame, int timeout)
|
||||||
{
|
{
|
||||||
V4L2Buffer *avbuf;
|
V4L2Buffer *avbuf;
|
||||||
@ -51423,7 +51428,7 @@ index 29b144ed73..ec7ad13be6 100644
|
|||||||
|
|
||||||
return ff_v4l2_buffer_buf_to_avframe(frame, avbuf);
|
return ff_v4l2_buffer_buf_to_avframe(frame, avbuf);
|
||||||
}
|
}
|
||||||
@@ -656,19 +871,10 @@ int ff_v4l2_context_dequeue_frame(V4L2Context* ctx, AVFrame* frame, int timeout)
|
@@ -656,19 +870,10 @@ int ff_v4l2_context_dequeue_frame(V4L2Context* ctx, AVFrame* frame, int timeout)
|
||||||
int ff_v4l2_context_dequeue_packet(V4L2Context* ctx, AVPacket* pkt)
|
int ff_v4l2_context_dequeue_packet(V4L2Context* ctx, AVPacket* pkt)
|
||||||
{
|
{
|
||||||
V4L2Buffer *avbuf;
|
V4L2Buffer *avbuf;
|
||||||
@ -51446,7 +51451,7 @@ index 29b144ed73..ec7ad13be6 100644
|
|||||||
|
|
||||||
return ff_v4l2_buffer_buf_to_avpkt(pkt, avbuf);
|
return ff_v4l2_buffer_buf_to_avpkt(pkt, avbuf);
|
||||||
}
|
}
|
||||||
@@ -702,78 +908,160 @@ int ff_v4l2_context_get_format(V4L2Context* ctx, int probe)
|
@@ -702,78 +907,160 @@ int ff_v4l2_context_get_format(V4L2Context* ctx, int probe)
|
||||||
|
|
||||||
int ff_v4l2_context_set_format(V4L2Context* ctx)
|
int ff_v4l2_context_set_format(V4L2Context* ctx)
|
||||||
{
|
{
|
||||||
@ -51504,14 +51509,14 @@ index 29b144ed73..ec7ad13be6 100644
|
|||||||
+ V4L2m2mContext * const s = ctx_to_m2mctx(ctx);
|
+ V4L2m2mContext * const s = ctx_to_m2mctx(ctx);
|
||||||
struct v4l2_requestbuffers req;
|
struct v4l2_requestbuffers req;
|
||||||
- int ret, i;
|
- int ret, i;
|
||||||
+ int ret;
|
-
|
||||||
+ int i;
|
|
||||||
|
|
||||||
- if (!v4l2_type_supported(ctx)) {
|
- if (!v4l2_type_supported(ctx)) {
|
||||||
- av_log(logger(ctx), AV_LOG_ERROR, "type %i not supported\n", ctx->type);
|
- av_log(logger(ctx), AV_LOG_ERROR, "type %i not supported\n", ctx->type);
|
||||||
- return AVERROR_PATCHWELCOME;
|
- return AVERROR_PATCHWELCOME;
|
||||||
- }
|
- }
|
||||||
-
|
+ int ret;
|
||||||
|
+ int i;
|
||||||
|
|
||||||
- ret = ioctl(s->fd, VIDIOC_G_FMT, &ctx->format);
|
- ret = ioctl(s->fd, VIDIOC_G_FMT, &ctx->format);
|
||||||
- if (ret)
|
- if (ret)
|
||||||
- av_log(logger(ctx), AV_LOG_ERROR, "%s VIDIOC_G_FMT failed\n", ctx->name);
|
- av_log(logger(ctx), AV_LOG_ERROR, "%s VIDIOC_G_FMT failed\n", ctx->name);
|
||||||
@ -51714,7 +51719,7 @@ index 22a9532444..a56216e990 100644
|
|||||||
/**
|
/**
|
||||||
* Enqueues a buffer to a V4L2Context from an AVFrame
|
* Enqueues a buffer to a V4L2Context from an AVFrame
|
||||||
diff --git a/libavcodec/v4l2_m2m.c b/libavcodec/v4l2_m2m.c
|
diff --git a/libavcodec/v4l2_m2m.c b/libavcodec/v4l2_m2m.c
|
||||||
index e48b3a8ccf..95b0d12a18 100644
|
index e48b3a8ccf..32288e5a99 100644
|
||||||
--- a/libavcodec/v4l2_m2m.c
|
--- a/libavcodec/v4l2_m2m.c
|
||||||
+++ b/libavcodec/v4l2_m2m.c
|
+++ b/libavcodec/v4l2_m2m.c
|
||||||
@@ -215,13 +215,7 @@ int ff_v4l2_m2m_codec_reinit(V4L2m2mContext *s)
|
@@ -215,13 +215,7 @@ int ff_v4l2_m2m_codec_reinit(V4L2m2mContext *s)
|
||||||
@ -51747,7 +51752,7 @@ index e48b3a8ccf..95b0d12a18 100644
|
|||||||
|
|
||||||
ret = ff_v4l2_context_get_format(&s->output, 0);
|
ret = ff_v4l2_context_get_format(&s->output, 0);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
@@ -328,7 +320,10 @@ static void v4l2_m2m_destroy_context(void *opaque, uint8_t *context)
|
@@ -328,7 +320,13 @@ static void v4l2_m2m_destroy_context(void *opaque, uint8_t *context)
|
||||||
ff_v4l2_context_release(&s->capture);
|
ff_v4l2_context_release(&s->capture);
|
||||||
sem_destroy(&s->refsync);
|
sem_destroy(&s->refsync);
|
||||||
|
|
||||||
@ -51755,11 +51760,14 @@ index e48b3a8ccf..95b0d12a18 100644
|
|||||||
+ if (s->fd != -1)
|
+ if (s->fd != -1)
|
||||||
+ close(s->fd);
|
+ close(s->fd);
|
||||||
+
|
+
|
||||||
|
+ av_packet_unref(&s->buf_pkt);
|
||||||
|
+ av_freep(&s->extdata_data);
|
||||||
|
+
|
||||||
+ av_log(s->avctx, AV_LOG_DEBUG, "V4L2 Context destroyed\n");
|
+ av_log(s->avctx, AV_LOG_DEBUG, "V4L2 Context destroyed\n");
|
||||||
|
|
||||||
av_free(s);
|
av_free(s);
|
||||||
}
|
}
|
||||||
@@ -338,17 +333,34 @@ int ff_v4l2_m2m_codec_end(V4L2m2mPriv *priv)
|
@@ -338,17 +336,34 @@ int ff_v4l2_m2m_codec_end(V4L2m2mPriv *priv)
|
||||||
V4L2m2mContext *s = priv->context;
|
V4L2m2mContext *s = priv->context;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
@ -51801,7 +51809,7 @@ index e48b3a8ccf..95b0d12a18 100644
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
diff --git a/libavcodec/v4l2_m2m.h b/libavcodec/v4l2_m2m.h
|
diff --git a/libavcodec/v4l2_m2m.h b/libavcodec/v4l2_m2m.h
|
||||||
index 456281f48c..727d774ac2 100644
|
index 456281f48c..8544b528e1 100644
|
||||||
--- a/libavcodec/v4l2_m2m.h
|
--- a/libavcodec/v4l2_m2m.h
|
||||||
+++ b/libavcodec/v4l2_m2m.h
|
+++ b/libavcodec/v4l2_m2m.h
|
||||||
@@ -30,6 +30,7 @@
|
@@ -30,6 +30,7 @@
|
||||||
@ -51860,7 +51868,7 @@ index 456281f48c..727d774ac2 100644
|
|||||||
|
|
||||||
/* null frame/packet received */
|
/* null frame/packet received */
|
||||||
int draining;
|
int draining;
|
||||||
@@ -63,6 +94,30 @@ typedef struct V4L2m2mContext {
|
@@ -63,6 +94,33 @@ typedef struct V4L2m2mContext {
|
||||||
|
|
||||||
/* reference back to V4L2m2mPriv */
|
/* reference back to V4L2m2mPriv */
|
||||||
void *priv;
|
void *priv;
|
||||||
@ -51882,6 +51890,9 @@ index 456281f48c..727d774ac2 100644
|
|||||||
+
|
+
|
||||||
+ /* Ext data sent */
|
+ /* Ext data sent */
|
||||||
+ int extdata_sent;
|
+ int extdata_sent;
|
||||||
|
+ /* Ext data sent in packet - overrides ctx */
|
||||||
|
+ uint8_t * extdata_data;
|
||||||
|
+ size_t extdata_size;
|
||||||
+
|
+
|
||||||
+#define FF_V4L2_QUIRK_REINIT_ALWAYS 1
|
+#define FF_V4L2_QUIRK_REINIT_ALWAYS 1
|
||||||
+#define FF_V4L2_QUIRK_ENUM_FRAMESIZES_BROKEN 2
|
+#define FF_V4L2_QUIRK_ENUM_FRAMESIZES_BROKEN 2
|
||||||
@ -51891,7 +51902,7 @@ index 456281f48c..727d774ac2 100644
|
|||||||
} V4L2m2mContext;
|
} V4L2m2mContext;
|
||||||
|
|
||||||
typedef struct V4L2m2mPriv {
|
typedef struct V4L2m2mPriv {
|
||||||
@@ -73,6 +128,7 @@ typedef struct V4L2m2mPriv {
|
@@ -73,6 +131,7 @@ typedef struct V4L2m2mPriv {
|
||||||
|
|
||||||
int num_output_buffers;
|
int num_output_buffers;
|
||||||
int num_capture_buffers;
|
int num_capture_buffers;
|
||||||
@ -51899,7 +51910,7 @@ index 456281f48c..727d774ac2 100644
|
|||||||
} V4L2m2mPriv;
|
} V4L2m2mPriv;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -126,4 +182,26 @@ int ff_v4l2_m2m_codec_reinit(V4L2m2mContext *ctx);
|
@@ -126,4 +185,26 @@ int ff_v4l2_m2m_codec_reinit(V4L2m2mContext *ctx);
|
||||||
*/
|
*/
|
||||||
int ff_v4l2_m2m_codec_full_reinit(V4L2m2mContext *ctx);
|
int ff_v4l2_m2m_codec_full_reinit(V4L2m2mContext *ctx);
|
||||||
|
|
||||||
@ -51927,7 +51938,7 @@ index 456281f48c..727d774ac2 100644
|
|||||||
+
|
+
|
||||||
#endif /* AVCODEC_V4L2_M2M_H */
|
#endif /* AVCODEC_V4L2_M2M_H */
|
||||||
diff --git a/libavcodec/v4l2_m2m_dec.c b/libavcodec/v4l2_m2m_dec.c
|
diff --git a/libavcodec/v4l2_m2m_dec.c b/libavcodec/v4l2_m2m_dec.c
|
||||||
index 3e17e0fcac..d614d14914 100644
|
index 3e17e0fcac..dd383f31e5 100644
|
||||||
--- a/libavcodec/v4l2_m2m_dec.c
|
--- a/libavcodec/v4l2_m2m_dec.c
|
||||||
+++ b/libavcodec/v4l2_m2m_dec.c
|
+++ b/libavcodec/v4l2_m2m_dec.c
|
||||||
@@ -23,6 +23,10 @@
|
@@ -23,6 +23,10 @@
|
||||||
@ -51941,7 +51952,7 @@ index 3e17e0fcac..d614d14914 100644
|
|||||||
#include "libavutil/pixfmt.h"
|
#include "libavutil/pixfmt.h"
|
||||||
#include "libavutil/pixdesc.h"
|
#include "libavutil/pixdesc.h"
|
||||||
#include "libavutil/opt.h"
|
#include "libavutil/opt.h"
|
||||||
@@ -30,75 +34,102 @@
|
@@ -30,75 +34,107 @@
|
||||||
#include "libavcodec/decode.h"
|
#include "libavcodec/decode.h"
|
||||||
#include "libavcodec/internal.h"
|
#include "libavcodec/internal.h"
|
||||||
|
|
||||||
@ -52038,21 +52049,16 @@ index 3e17e0fcac..d614d14914 100644
|
|||||||
- ret = ioctl(s->fd, VIDIOC_G_FMT, &capture->format);
|
- ret = ioctl(s->fd, VIDIOC_G_FMT, &capture->format);
|
||||||
- if (ret) {
|
- if (ret) {
|
||||||
- av_log(avctx, AV_LOG_WARNING, "VIDIOC_G_FMT ioctl\n");
|
- av_log(avctx, AV_LOG_WARNING, "VIDIOC_G_FMT ioctl\n");
|
||||||
- return ret;
|
|
||||||
- }
|
|
||||||
+ ret = ff_v4l2_context_set_status(&s->output, VIDIOC_STREAMON);
|
+ ret = ff_v4l2_context_set_status(&s->output, VIDIOC_STREAMON);
|
||||||
+ if (ret < 0)
|
+ if (ret != 0) {
|
||||||
+ av_log(avctx, AV_LOG_ERROR, "VIDIOC_STREAMON on output context\n");
|
+ av_log(avctx, AV_LOG_ERROR, "VIDIOC_STREAMON on output context: %s\n", av_err2str(ret));
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
- /* 2.1 update the AVCodecContext */
|
- /* 2.1 update the AVCodecContext */
|
||||||
- avctx->pix_fmt = ff_v4l2_format_v4l2_to_avfmt(capture->format.fmt.pix_mp.pixelformat, AV_CODEC_ID_RAWVIDEO);
|
- avctx->pix_fmt = ff_v4l2_format_v4l2_to_avfmt(capture->format.fmt.pix_mp.pixelformat, AV_CODEC_ID_RAWVIDEO);
|
||||||
- capture->av_pix_fmt = avctx->pix_fmt;
|
- capture->av_pix_fmt = avctx->pix_fmt;
|
||||||
+ ret = ioctl(s->fd, VIDIOC_DECODER_CMD, &cmd);
|
-
|
||||||
+ if (ret < 0)
|
|
||||||
+ av_log(avctx, AV_LOG_ERROR, "VIDIOC_DECODER_CMD start error: %d\n", errno);
|
|
||||||
+ else
|
|
||||||
+ av_log(avctx, AV_LOG_DEBUG, "VIDIOC_DECODER_CMD start OK\n");
|
|
||||||
|
|
||||||
- /* 3. set the crop parameters */
|
- /* 3. set the crop parameters */
|
||||||
- selection.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
|
- selection.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
|
||||||
- selection.r.height = avctx->coded_height;
|
- selection.r.height = avctx->coded_height;
|
||||||
@ -52068,10 +52074,13 @@ index 3e17e0fcac..d614d14914 100644
|
|||||||
- capture->height = selection.r.height;
|
- capture->height = selection.r.height;
|
||||||
- capture->width = selection.r.width;
|
- capture->width = selection.r.width;
|
||||||
- }
|
- }
|
||||||
- }
|
+ // STREAMON should do implicit START so this just for those that don't.
|
||||||
+ return ret;
|
+ // It is optional so don't worry if it fails
|
||||||
+}
|
+ if (ioctl(s->fd, VIDIOC_DECODER_CMD, &cmd) < 0) {
|
||||||
|
+ ret = AVERROR(errno);
|
||||||
|
+ av_log(avctx, AV_LOG_WARNING, "VIDIOC_DECODER_CMD start error: %s\n", av_err2str(ret));
|
||||||
|
}
|
||||||
|
-
|
||||||
- /* 4. init the capture context now that we have the capture format */
|
- /* 4. init the capture context now that we have the capture format */
|
||||||
- if (!capture->buffers) {
|
- if (!capture->buffers) {
|
||||||
- ret = ff_v4l2_context_init(capture);
|
- ret = ff_v4l2_context_init(capture);
|
||||||
@ -52079,25 +52088,30 @@ index 3e17e0fcac..d614d14914 100644
|
|||||||
- av_log(avctx, AV_LOG_ERROR, "can't request capture buffers\n");
|
- av_log(avctx, AV_LOG_ERROR, "can't request capture buffers\n");
|
||||||
- return AVERROR(ENOMEM);
|
- return AVERROR(ENOMEM);
|
||||||
- }
|
- }
|
||||||
|
+ else {
|
||||||
|
+ av_log(avctx, AV_LOG_TRACE, "VIDIOC_DECODER_CMD start OK\n");
|
||||||
|
}
|
||||||
|
+ return 0;
|
||||||
|
+}
|
||||||
|
|
||||||
|
- /* 5. start the capture process */
|
||||||
|
- ret = ff_v4l2_context_set_status(capture, VIDIOC_STREAMON);
|
||||||
|
- if (ret) {
|
||||||
|
- av_log(avctx, AV_LOG_DEBUG, "VIDIOC_STREAMON, on capture context\n");
|
||||||
|
- return ret;
|
||||||
- }
|
- }
|
||||||
+static int v4l2_try_start(AVCodecContext *avctx)
|
+static int v4l2_try_start(AVCodecContext *avctx)
|
||||||
+{
|
+{
|
||||||
+ V4L2m2mContext * const s = ((V4L2m2mPriv*)avctx->priv_data)->context;
|
+ V4L2m2mContext * const s = ((V4L2m2mPriv*)avctx->priv_data)->context;
|
||||||
+ int ret;
|
+ int ret;
|
||||||
|
|
||||||
- /* 5. start the capture process */
|
|
||||||
- ret = ff_v4l2_context_set_status(capture, VIDIOC_STREAMON);
|
|
||||||
- if (ret) {
|
|
||||||
- av_log(avctx, AV_LOG_DEBUG, "VIDIOC_STREAMON, on capture context\n");
|
|
||||||
+ /* 1. start the output process */
|
+ /* 1. start the output process */
|
||||||
+ if ((ret = check_output_streamon(avctx, s)) != 0)
|
+ if ((ret = check_output_streamon(avctx, s)) != 0)
|
||||||
return ret;
|
+ return ret;
|
||||||
- }
|
|
||||||
-
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -133,52 +164,557 @@ static int v4l2_prepare_decoder(V4L2m2mContext *s)
|
@@ -133,52 +169,606 @@ static int v4l2_prepare_decoder(V4L2m2mContext *s)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -52291,7 +52305,46 @@ index 3e17e0fcac..d614d14914 100644
|
|||||||
+ // We will already have a coded pkt if the output Q was full last time we
|
+ // We will already have a coded pkt if the output Q was full last time we
|
||||||
+ // tried to Q it
|
+ // tried to Q it
|
||||||
+ if (!s->buf_pkt.size && !do_not_get) {
|
+ if (!s->buf_pkt.size && !do_not_get) {
|
||||||
+ ret = ff_decode_get_packet(avctx, &s->buf_pkt);
|
+ unsigned int i;
|
||||||
|
+
|
||||||
|
+ for (i = 0; i < 256; ++i) {
|
||||||
|
+ uint8_t * side_data;
|
||||||
|
+ size_t side_size;
|
||||||
|
+
|
||||||
|
+ ret = ff_decode_get_packet(avctx, &s->buf_pkt);
|
||||||
|
+ if (ret != 0)
|
||||||
|
+ break;
|
||||||
|
+
|
||||||
|
+ // New extradata is the only side-data we undertand
|
||||||
|
+ side_data = av_packet_get_side_data(&s->buf_pkt, AV_PKT_DATA_NEW_EXTRADATA, &side_size);
|
||||||
|
+ if (side_data) {
|
||||||
|
+ av_log(avctx, AV_LOG_DEBUG, "New extradata\n");
|
||||||
|
+ av_freep(&s->extdata_data);
|
||||||
|
+ if ((s->extdata_data = av_malloc(side_size ? side_size : 1)) == NULL) {
|
||||||
|
+ av_log(avctx, AV_LOG_ERROR, "Failed to alloc %zd bytes of extra data\n", side_size);
|
||||||
|
+ return AVERROR(ENOMEM);
|
||||||
|
+ }
|
||||||
|
+ memcpy(s->extdata_data, side_data, side_size);
|
||||||
|
+ s->extdata_size = side_size;
|
||||||
|
+ s->extdata_sent = 0;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (s->buf_pkt.size != 0)
|
||||||
|
+ break;
|
||||||
|
+
|
||||||
|
+ if (s->buf_pkt.side_data_elems == 0) {
|
||||||
|
+ av_log(avctx, AV_LOG_WARNING, "Empty pkt from ff_decode_get_packet - treating as EOF\n");
|
||||||
|
+ ret = AVERROR_EOF;
|
||||||
|
+ break;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ // Retry a side-data only pkt
|
||||||
|
+ }
|
||||||
|
+ // If i >= 256 something has gone wrong
|
||||||
|
+ if (i >= 256) {
|
||||||
|
+ av_log(avctx, AV_LOG_ERROR, "Too many side-data only packets\n");
|
||||||
|
+ return AVERROR(EIO);
|
||||||
|
+ }
|
||||||
+
|
+
|
||||||
+ if (ret == AVERROR(EAGAIN)) {
|
+ if (ret == AVERROR(EAGAIN)) {
|
||||||
+ if (!stream_started(s)) {
|
+ if (!stream_started(s)) {
|
||||||
@ -52330,18 +52383,18 @@ index 3e17e0fcac..d614d14914 100644
|
|||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ xlat_pts_in(avctx, &s->xlat, &s->buf_pkt);
|
+ xlat_pts_in(avctx, &s->xlat, &s->buf_pkt);
|
||||||
+ }
|
}
|
||||||
+
|
|
||||||
|
- if (s->draining)
|
||||||
|
- goto dequeue;
|
||||||
+ if (s->draining) {
|
+ if (s->draining) {
|
||||||
+ if (s->buf_pkt.size) {
|
+ if (s->buf_pkt.size) {
|
||||||
+ av_log(avctx, AV_LOG_WARNING, "Unexpected input whilst draining\n");
|
+ av_log(avctx, AV_LOG_WARNING, "Unexpected input whilst draining\n");
|
||||||
+ av_packet_unref(&s->buf_pkt);
|
+ av_packet_unref(&s->buf_pkt);
|
||||||
+ }
|
+ }
|
||||||
+ return NQ_DRAINING;
|
+ return NQ_DRAINING;
|
||||||
}
|
+ }
|
||||||
|
+
|
||||||
- if (s->draining)
|
|
||||||
- goto dequeue;
|
|
||||||
+ if (!s->buf_pkt.size)
|
+ if (!s->buf_pkt.size)
|
||||||
+ return NQ_NONE;
|
+ return NQ_NONE;
|
||||||
+
|
+
|
||||||
@ -52352,8 +52405,12 @@ index 3e17e0fcac..d614d14914 100644
|
|||||||
- if (ret < 0) {
|
- if (ret < 0) {
|
||||||
- if (ret != AVERROR(EAGAIN))
|
- if (ret != AVERROR(EAGAIN))
|
||||||
- return ret;
|
- return ret;
|
||||||
+ ret = ff_v4l2_context_enqueue_packet(&s->output, &s->buf_pkt,
|
+ if (s->extdata_sent)
|
||||||
+ avctx->extradata, s->extdata_sent ? 0 : avctx->extradata_size);
|
+ ret = ff_v4l2_context_enqueue_packet(&s->output, &s->buf_pkt, NULL, 0);
|
||||||
|
+ else if (s->extdata_data)
|
||||||
|
+ ret = ff_v4l2_context_enqueue_packet(&s->output, &s->buf_pkt, s->extdata_data, s->extdata_size);
|
||||||
|
+ else
|
||||||
|
+ ret = ff_v4l2_context_enqueue_packet(&s->output, &s->buf_pkt, avctx->extradata, avctx->extradata_size);
|
||||||
|
|
||||||
- s->buf_pkt = avpkt;
|
- s->buf_pkt = avpkt;
|
||||||
- /* no input buffers available, continue dequeing */
|
- /* no input buffers available, continue dequeing */
|
||||||
@ -52374,7 +52431,10 @@ index 3e17e0fcac..d614d14914 100644
|
|||||||
+ return ret;
|
+ return ret;
|
||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
+
|
|
||||||
|
- /* cant recover */
|
||||||
|
- if (ret == AVERROR(ENOMEM))
|
||||||
|
- return ret;
|
||||||
+ // Start if we haven't
|
+ // Start if we haven't
|
||||||
+ {
|
+ {
|
||||||
+ const int ret2 = v4l2_try_start(avctx);
|
+ const int ret2 = v4l2_try_start(avctx);
|
||||||
@ -52387,16 +52447,13 @@ index 3e17e0fcac..d614d14914 100644
|
|||||||
+ return ret;
|
+ return ret;
|
||||||
+}
|
+}
|
||||||
|
|
||||||
- /* cant recover */
|
- return 0;
|
||||||
- if (ret == AVERROR(ENOMEM))
|
|
||||||
- return ret;
|
|
||||||
+static int qbuf_wait(AVCodecContext * const avctx, V4L2Context * const ctx)
|
+static int qbuf_wait(AVCodecContext * const avctx, V4L2Context * const ctx)
|
||||||
+{
|
+{
|
||||||
+ int rv = 0;
|
+ int rv = 0;
|
||||||
+
|
+
|
||||||
+ ff_mutex_lock(&ctx->lock);
|
+ ff_mutex_lock(&ctx->lock);
|
||||||
|
+
|
||||||
- return 0;
|
|
||||||
+ while (atomic_load(&ctx->q_count) == 0 && ctx->streamon) {
|
+ while (atomic_load(&ctx->q_count) == 0 && ctx->streamon) {
|
||||||
+ if (pthread_cond_wait(&ctx->cond, &ctx->lock) != 0) {
|
+ if (pthread_cond_wait(&ctx->cond, &ctx->lock) != 0) {
|
||||||
+ rv = AVERROR(errno);
|
+ rv = AVERROR(errno);
|
||||||
@ -52428,13 +52485,14 @@ index 3e17e0fcac..d614d14914 100644
|
|||||||
+static int v4l2_receive_frame(AVCodecContext *avctx, AVFrame *frame)
|
+static int v4l2_receive_frame(AVCodecContext *avctx, AVFrame *frame)
|
||||||
+{
|
+{
|
||||||
+ V4L2m2mContext *const s = ((V4L2m2mPriv*)avctx->priv_data)->context;
|
+ V4L2m2mContext *const s = ((V4L2m2mPriv*)avctx->priv_data)->context;
|
||||||
+ int src_rv;
|
+ int src_rv = NQ_OK;
|
||||||
+ int dst_rv = 1; // Non-zero (done), non-negative (error) number
|
+ int dst_rv = 1; // Non-zero (done), non-negative (error) number
|
||||||
+ unsigned int i = 0;
|
+ unsigned int i = 0;
|
||||||
+
|
+
|
||||||
+ do {
|
+ do {
|
||||||
+ const int pending = xlat_pending(&s->xlat);
|
+ const int pending = xlat_pending(&s->xlat);
|
||||||
+ const int prefer_dq = (pending > s->pending_hw / 16);
|
+ const int prefer_dq = (pending > s->pending_hw / 16);
|
||||||
|
+ const int last_src_rv = src_rv;
|
||||||
+
|
+
|
||||||
+ // Enqueue another pkt for decode if
|
+ // Enqueue another pkt for decode if
|
||||||
+ // (a) We don't have a lot of stuff in the buffer already OR
|
+ // (a) We don't have a lot of stuff in the buffer already OR
|
||||||
@ -52450,6 +52508,11 @@ index 3e17e0fcac..d614d14914 100644
|
|||||||
+ if ((i != 0 || s->req_pkt) && src_rv == NQ_SRC_EMPTY)
|
+ if ((i != 0 || s->req_pkt) && src_rv == NQ_SRC_EMPTY)
|
||||||
+ break;
|
+ break;
|
||||||
+
|
+
|
||||||
|
+ if (src_rv == NQ_Q_FULL && last_src_rv == NQ_Q_FULL) {
|
||||||
|
+ av_log(avctx, AV_LOG_WARNING, "Poll thinks src Q has space; none found\n");
|
||||||
|
+ break;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
+ // Try to get a new frame if
|
+ // Try to get a new frame if
|
||||||
+ // (a) we haven't already got one AND
|
+ // (a) we haven't already got one AND
|
||||||
+ // (b) enqueue returned a status indicating that decode should be attempted
|
+ // (b) enqueue returned a status indicating that decode should be attempted
|
||||||
@ -52685,7 +52748,7 @@ index 3e17e0fcac..d614d14914 100644
|
|||||||
}
|
}
|
||||||
|
|
||||||
static av_cold int v4l2_decode_init(AVCodecContext *avctx)
|
static av_cold int v4l2_decode_init(AVCodecContext *avctx)
|
||||||
@@ -186,12 +722,30 @@ static av_cold int v4l2_decode_init(AVCodecContext *avctx)
|
@@ -186,12 +776,30 @@ static av_cold int v4l2_decode_init(AVCodecContext *avctx)
|
||||||
V4L2Context *capture, *output;
|
V4L2Context *capture, *output;
|
||||||
V4L2m2mContext *s;
|
V4L2m2mContext *s;
|
||||||
V4L2m2mPriv *priv = avctx->priv_data;
|
V4L2m2mPriv *priv = avctx->priv_data;
|
||||||
@ -52716,7 +52779,7 @@ index 3e17e0fcac..d614d14914 100644
|
|||||||
capture = &s->capture;
|
capture = &s->capture;
|
||||||
output = &s->output;
|
output = &s->output;
|
||||||
|
|
||||||
@@ -199,34 +753,129 @@ static av_cold int v4l2_decode_init(AVCodecContext *avctx)
|
@@ -199,34 +807,129 @@ static av_cold int v4l2_decode_init(AVCodecContext *avctx)
|
||||||
* by the v4l2 driver; this event will trigger a full pipeline reconfig and
|
* by the v4l2 driver; this event will trigger a full pipeline reconfig and
|
||||||
* the proper values will be retrieved from the kernel driver.
|
* the proper values will be retrieved from the kernel driver.
|
||||||
*/
|
*/
|
||||||
@ -52855,7 +52918,7 @@ index 3e17e0fcac..d614d14914 100644
|
|||||||
}
|
}
|
||||||
|
|
||||||
#define OFFSET(x) offsetof(V4L2m2mPriv, x)
|
#define OFFSET(x) offsetof(V4L2m2mPriv, x)
|
||||||
@@ -235,10 +884,16 @@ static av_cold int v4l2_decode_close(AVCodecContext *avctx)
|
@@ -235,10 +938,16 @@ static av_cold int v4l2_decode_close(AVCodecContext *avctx)
|
||||||
static const AVOption options[] = {
|
static const AVOption options[] = {
|
||||||
V4L_M2M_DEFAULT_OPTS,
|
V4L_M2M_DEFAULT_OPTS,
|
||||||
{ "num_capture_buffers", "Number of buffers in the capture context",
|
{ "num_capture_buffers", "Number of buffers in the capture context",
|
||||||
@ -52873,7 +52936,7 @@ index 3e17e0fcac..d614d14914 100644
|
|||||||
#define M2MDEC_CLASS(NAME) \
|
#define M2MDEC_CLASS(NAME) \
|
||||||
static const AVClass v4l2_m2m_ ## NAME ## _dec_class = { \
|
static const AVClass v4l2_m2m_ ## NAME ## _dec_class = { \
|
||||||
.class_name = #NAME "_v4l2m2m_decoder", \
|
.class_name = #NAME "_v4l2m2m_decoder", \
|
||||||
@@ -259,9 +914,15 @@ static const AVOption options[] = {
|
@@ -259,9 +968,15 @@ static const AVOption options[] = {
|
||||||
.init = v4l2_decode_init, \
|
.init = v4l2_decode_init, \
|
||||||
.receive_frame = v4l2_receive_frame, \
|
.receive_frame = v4l2_receive_frame, \
|
||||||
.close = v4l2_decode_close, \
|
.close = v4l2_decode_close, \
|
||||||
@ -65428,10 +65491,10 @@ index 0000000000..fc14f2a3c2
|
|||||||
+1,WPP_F_ericsson_MAIN_2,WPP_F_ericsson_MAIN_2.bit,WPP_F_ericsson_MAIN_2_yuv.md5
|
+1,WPP_F_ericsson_MAIN_2,WPP_F_ericsson_MAIN_2.bit,WPP_F_ericsson_MAIN_2_yuv.md5
|
||||||
diff --git a/pi-util/conf_native.sh b/pi-util/conf_native.sh
|
diff --git a/pi-util/conf_native.sh b/pi-util/conf_native.sh
|
||||||
new file mode 100755
|
new file mode 100755
|
||||||
index 0000000000..65576846e8
|
index 0000000000..37cea71756
|
||||||
--- /dev/null
|
--- /dev/null
|
||||||
+++ b/pi-util/conf_native.sh
|
+++ b/pi-util/conf_native.sh
|
||||||
@@ -0,0 +1,108 @@
|
@@ -0,0 +1,106 @@
|
||||||
+echo "Configure for native build"
|
+echo "Configure for native build"
|
||||||
+
|
+
|
||||||
+FFSRC=`pwd`
|
+FFSRC=`pwd`
|
||||||
@ -65525,8 +65588,6 @@ index 0000000000..65576846e8
|
|||||||
+ --disable-thumb\
|
+ --disable-thumb\
|
||||||
+ --enable-v4l2-request\
|
+ --enable-v4l2-request\
|
||||||
+ --enable-libdrm\
|
+ --enable-libdrm\
|
||||||
+ --enable-epoxy\
|
|
||||||
+ --enable-libudev\
|
|
||||||
+ --enable-vout-egl\
|
+ --enable-vout-egl\
|
||||||
+ --enable-vout-drm\
|
+ --enable-vout-drm\
|
||||||
+ $SHARED_LIBS\
|
+ $SHARED_LIBS\
|
||||||
|
Loading…
x
Reference in New Issue
Block a user