[FFmpeg-cvslog] avfoundation: Fix version checks

2023-12-15 Thread Martin Storsjö
ffmpeg | branch: master | Martin Storsjö  | Fri Dec 15 
12:11:12 2023 +0200| [081d69b78df8d1f38f99faaa9b9598592c82303b] | committer: 
Thilo Borgmann

avfoundation: Fix version checks

_VERSION_MAX_ALLOWED indicates what version is available in
the SDK, while _VERSION_MIN_REQUIRED is the version we can
assume is available, i.e. similar to what is set with e.g.
-miphoneos-version-min on the command line.

This fixes build errors like these:

src/libavdevice/avfoundation.m:788:37: error: 
'AVCaptureDeviceTypeContinuityCamera' is only available on macOS 14.0 or newer 
[-Werror,-Wunguarded-availability-new]
[deviceTypes addObject: AVCaptureDeviceTypeContinuityCamera];
^~~
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/AVFoundation.framework/Headers/AVCaptureDevice.h:551:38:
 note: 'AVCaptureDeviceTypeContinuityCamera' has been marked as being 
introduced in macOS 14.0 here, but the deployment target is macOS 13.0.0
AVF_EXPORT AVCaptureDeviceType const AVCaptureDeviceTypeContinuityCamera 
API_AVAILABLE(macos(14.0), ios(17.0), macCatalyst(17.0), tvos(17.0)) 
API_UNAVAILABLE(visionos) API_UNAVAILABLE(watchos);
 ^

Alternatively, we could use these more modern APIs, if enclosed
in suitable @available() checks.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=081d69b78df8d1f38f99faaa9b9598592c82303b
---

 libavdevice/avfoundation.m | 20 ++--
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/libavdevice/avfoundation.m b/libavdevice/avfoundation.m
index c1432ec80f..a0ef87edff 100644
--- a/libavdevice/avfoundation.m
+++ b/libavdevice/avfoundation.m
@@ -762,41 +762,41 @@ static int get_audio_config(AVFormatContext *s)
 }
 
 static NSArray* getDevicesWithMediaType(AVMediaType mediaType) {
-#if ((TARGET_OS_IPHONE && __IPHONE_OS_VERSION_MAX_ALLOWED >= 10) || 
(TARGET_OS_OSX && __MAC_OS_X_VERSION_MAX_ALLOWED >= 101500))
+#if ((TARGET_OS_IPHONE && __IPHONE_OS_VERSION_MIN_REQUIRED >= 10) || 
(TARGET_OS_OSX && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101500))
 NSMutableArray *deviceTypes = nil;
 if (mediaType == AVMediaTypeVideo) {
 deviceTypes = [NSMutableArray 
arrayWithArray:@[AVCaptureDeviceTypeBuiltInWideAngleCamera]];
-#if (TARGET_OS_IPHONE && __IPHONE_OS_VERSION_MAX_ALLOWED >= 10)
+#if (TARGET_OS_IPHONE && __IPHONE_OS_VERSION_MIN_REQUIRED >= 10)
 [deviceTypes addObject: AVCaptureDeviceTypeBuiltInDualCamera];
 [deviceTypes addObject: AVCaptureDeviceTypeBuiltInTelephotoCamera];
 #endif
-#if (TARGET_OS_IPHONE && __IPHONE_OS_VERSION_MAX_ALLOWED >= 110100)
+#if (TARGET_OS_IPHONE && __IPHONE_OS_VERSION_MIN_REQUIRED >= 110100)
 [deviceTypes addObject: AVCaptureDeviceTypeBuiltInTrueDepthCamera];
 #endif
-#if (TARGET_OS_IPHONE && __IPHONE_OS_VERSION_MAX_ALLOWED >= 13)
+#if (TARGET_OS_IPHONE && __IPHONE_OS_VERSION_MIN_REQUIRED >= 13)
 [deviceTypes addObject: AVCaptureDeviceTypeBuiltInTripleCamera];
 [deviceTypes addObject: AVCaptureDeviceTypeBuiltInDualWideCamera];
 [deviceTypes addObject: AVCaptureDeviceTypeBuiltInUltraWideCamera];
 #endif
-#if (TARGET_OS_OSX && __MAC_OS_X_VERSION_MAX_ALLOWED >= 13)
+#if (TARGET_OS_OSX && __MAC_OS_X_VERSION_MIN_REQUIRED >= 13)
 [deviceTypes addObject: AVCaptureDeviceTypeDeskViewCamera];
 #endif
-#if (TARGET_OS_IPHONE && __IPHONE_OS_VERSION_MAX_ALLOWED >= 150400)
+#if (TARGET_OS_IPHONE && __IPHONE_OS_VERSION_MIN_REQUIRED >= 150400)
 [deviceTypes addObject: 
AVCaptureDeviceTypeBuiltInLiDARDepthCamera];
 #endif
-#if (TARGET_OS_IPHONE && __IPHONE_OS_VERSION_MAX_ALLOWED >= 17 || 
(TARGET_OS_OSX && __MAC_OS_X_VERSION_MAX_ALLOWED >= 14))
+#if (TARGET_OS_IPHONE && __IPHONE_OS_VERSION_MIN_REQUIRED >= 17 || 
(TARGET_OS_OSX && __MAC_OS_X_VERSION_MIN_REQUIRED >= 14))
 [deviceTypes addObject: AVCaptureDeviceTypeContinuityCamera];
 #endif
 } else if (mediaType == AVMediaTypeAudio) {
-#if (TARGET_OS_IPHONE && __IPHONE_OS_VERSION_MAX_ALLOWED >= 17 || 
(TARGET_OS_OSX && __MAC_OS_X_VERSION_MAX_ALLOWED >= 14))
+#if (TARGET_OS_IPHONE && __IPHONE_OS_VERSION_MIN_REQUIRED >= 17 || 
(TARGET_OS_OSX && __MAC_OS_X_VERSION_MIN_REQUIRED >= 14))
 deviceTypes = [NSMutableArray 
arrayWithArray:@[AVCaptureDeviceTypeMicrophone]];
 #else
 deviceTypes = [NSMutableArray 
arrayWithArray:@[AVCaptureDeviceTypeBuiltInMicrophone]];
 #endif
 } else if (mediaType == AVMediaTypeMuxed) {
-#if (TARGET_OS_IPHONE && __IPHONE_OS_VERSION_MAX_ALLOWED >= 17 || 
(TARGET_OS_OSX && __MAC_OS_X_VERSION_MAX_ALLOWED >= 14))
+  

[FFmpeg-cvslog] libavfilter/vf_dnn_detect: Add NULL pointer check

2023-12-15 Thread Wenbin Chen
ffmpeg | branch: master | Wenbin Chen  | Thu Dec 14 
10:49:26 2023 +0800| [833722343aa52c77893f2330d1dc06b5423da6fe] | committer: 
Guo Yejun

libavfilter/vf_dnn_detect: Add NULL pointer check

Signed-off-by: Wenbin Chen 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=833722343aa52c77893f2330d1dc06b5423da6fe
---

 libavfilter/vf_dnn_detect.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/libavfilter/vf_dnn_detect.c b/libavfilter/vf_dnn_detect.c
index b82916ce6d..b2e9b8d4c6 100644
--- a/libavfilter/vf_dnn_detect.c
+++ b/libavfilter/vf_dnn_detect.c
@@ -112,6 +112,10 @@ static int dnn_detect_parse_anchors(char *anchors_str, 
float **anchors)
 }
 for (int i = 0; i < nb_anchor; i++) {
 token = av_strtok(anchors_str, "&", &saveptr);
+if (!token) {
+av_freep(&anchors_buf);
+return 0;
+}
 anchors_buf[i] = strtof(token, NULL);
 anchors_str = NULL;
 }

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] libavfilter/vf_dnn_detect: Fix an incorrect expression

2023-12-15 Thread Wenbin Chen
ffmpeg | branch: master | Wenbin Chen  | Thu Dec 14 
10:49:25 2023 +0800| [e01afa1c6d53eeae93210830968c1f0c111c1b36] | committer: 
Guo Yejun

libavfilter/vf_dnn_detect: Fix an incorrect expression

Signed-off-by: Wenbin Chen 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e01afa1c6d53eeae93210830968c1f0c111c1b36
---

 libavfilter/vf_dnn_detect.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavfilter/vf_dnn_detect.c b/libavfilter/vf_dnn_detect.c
index 7ac3bb0b58..b82916ce6d 100644
--- a/libavfilter/vf_dnn_detect.c
+++ b/libavfilter/vf_dnn_detect.c
@@ -106,7 +106,7 @@ static int dnn_detect_parse_anchors(char *anchors_str, 
float **anchors)
 i++;
 }
 nb_anchor++;
-anchors_buf = av_mallocz(nb_anchor * sizeof(*anchors));
+anchors_buf = av_mallocz(nb_anchor * sizeof(**anchors));
 if (!anchors_buf) {
 return 0;
 }

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] libavfilter/vf_dnn_detect: Fix uninitialized variables error

2023-12-15 Thread Wenbin Chen
ffmpeg | branch: master | Wenbin Chen  | Thu Dec 14 
10:49:27 2023 +0800| [a1e8892a8a2e5d32e31cc5b30a3727700de51017] | committer: 
Guo Yejun

libavfilter/vf_dnn_detect: Fix uninitialized variables error

Signed-off-by: Wenbin Chen 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a1e8892a8a2e5d32e31cc5b30a3727700de51017
---

 libavfilter/vf_dnn_detect.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavfilter/vf_dnn_detect.c b/libavfilter/vf_dnn_detect.c
index b2e9b8d4c6..5668b8b017 100644
--- a/libavfilter/vf_dnn_detect.c
+++ b/libavfilter/vf_dnn_detect.c
@@ -139,7 +139,8 @@ static int dnn_detect_parse_yolo_output(AVFrame *frame, 
DNNData *output, int out
 {
 DnnDetectContext *ctx = filter_ctx->priv;
 float conf_threshold = ctx->confidence;
-int detection_boxes, box_size, cell_w, cell_h, scale_w, scale_h;
+int detection_boxes, box_size;
+int cell_w = 0, cell_h = 0, scale_w = 0, scale_h = 0;
 int nb_classes = ctx->nb_classes;
 float *output_data = output[output_index].data;
 float *anchors = ctx->anchors;

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] libavfilter/vf_dnn_detect: Set used pointer to NULL

2023-12-15 Thread Wenbin Chen
ffmpeg | branch: master | Wenbin Chen  | Thu Dec 14 
10:49:28 2023 +0800| [22bebfa5e6cfcbd332a387b6f91ae38a4cbaf8b9] | committer: 
Guo Yejun

libavfilter/vf_dnn_detect: Set used pointer to NULL

Set used pointer to NULL in case it leaks the storage.

Signed-off-by: Wenbin Chen 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=22bebfa5e6cfcbd332a387b6f91ae38a4cbaf8b9
---

 libavfilter/vf_dnn_detect.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavfilter/vf_dnn_detect.c b/libavfilter/vf_dnn_detect.c
index 5668b8b017..3464af86c8 100644
--- a/libavfilter/vf_dnn_detect.c
+++ b/libavfilter/vf_dnn_detect.c
@@ -223,6 +223,7 @@ static int dnn_detect_parse_yolo_output(AVFrame *frame, 
DNNData *output, int out
 av_freep(&bbox);
 return AVERROR(ENOMEM);
 }
+bbox = NULL;
 }
 }
 return 0;

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] fate/jpegxl: add multiframe permuted TOC image parser test

2023-12-15 Thread Leo Izen
ffmpeg | branch: master | Leo Izen  | Sat Dec  9 14:49:38 
2023 -0500| [1a049595320094bb3a03a0893fe69990c2eb4964] | committer: Leo Izen

fate/jpegxl: add multiframe permuted TOC image parser test

This test verifies the parser's handling of multiframe JXL files that
have an entropy-encoded permuted table of contents for each frame. The
testcase is actually six JXL codestreams concatenated together, and the
parser needs to be able to find the boundaries.

Signed-off-by: Leo Izen 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1a049595320094bb3a03a0893fe69990c2eb4964
---

 tests/fate/jxl.mak |  3 +++
 tests/ref/fate/jxl-multiframe-permuted-toc | 11 +++
 2 files changed, 14 insertions(+)

diff --git a/tests/fate/jxl.mak b/tests/fate/jxl.mak
index d653eb644a..1416b98f6d 100644
--- a/tests/fate/jxl.mak
+++ b/tests/fate/jxl.mak
@@ -19,6 +19,9 @@ fate-jxl-anim-demux: $(FATE_JPEGXL_ANIM_DEMUX)
 FATE_JPEGXL_PARSE += fate-jxl-small-ext-box
 fate-jxl-small-ext-box: CMD = framecrc -i $(TARGET_SAMPLES)/jxl/l.jxl -c copy
 
+FATE_JPEGXL_PARSE += fate-jxl-multiframe-permuted-toc
+fate-jxl-multiframe-permuted-toc: CMD = framecrc -i 
$(TARGET_SAMPLES)/jxl/orange.jxl -c copy
+
 FATE_JPEGXL_PARSE += $(FATE_JPEGXL_PARSE-yes)
 FATE_SAMPLES_FFMPEG-$(call FRAMECRC, IMAGE_JPEGXL_PIPE, , JPEGXL_PARSER) += 
$(FATE_JPEGXL_PARSE)
 fate-jxl-parse: $(FATE_JPEGXL_PARSE)
diff --git a/tests/ref/fate/jxl-multiframe-permuted-toc 
b/tests/ref/fate/jxl-multiframe-permuted-toc
new file mode 100644
index 00..94fc008143
--- /dev/null
+++ b/tests/ref/fate/jxl-multiframe-permuted-toc
@@ -0,0 +1,11 @@
+#tb 0: 1/25
+#media_type 0: video
+#codec_id 0: jpegxl
+#dimensions 0: 2400x2400
+#sar 0: 0/1
+0,  0,  0,1,   197602, 0x6f8fc984
+0,  1,  1,1,52335, 0x30421469
+0,  2,  2,1,20784, 0xaecb1df0
+0,  3,  3,1,11204, 0x6c7b0759
+0,  4,  4,1, 5653, 0xa2ac56da
+0,  5,  5,1,11204, 0x6c7b0759

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".