nareshmlx/opencv-pr huggingface dataset:
**File:** cmake/OpenCVFindOpenEXR.cmake
**Change Type:** modified
**Context:** PR #26678: build(4.x) OpenEXR 2.2 or earlier cannot be used with C++17 or later
**Review Line:** 154

**Code Changes:**
```diff
   if(NOT OPENEXR_VERSION)
     SET(OPENEXR_VERSION "Unknown")
+  else()
+    if(HAVE_CXX17 AND OPENEXR_VERSION VERSION_LESS "2.3.0")
+      message(STATUS "  OpenEXR(ver ${OPENEXR_VERSION}) doesn't support C++17 and higher. Updating OpenEXR 2.3.0+ is required.")
+      SET(OPENEXR_FOUND FALSE)
+    endif()
   endif()
 ELSE()
   IF(OPENEXR_FIND_REQUIRED)
```

Review comment:
> Forcing ‘BUILD_OPENEXR=ON` losts user-selectability and it looks like bug. I am quite open to this. But for your solution, you should add a message saying bundled OpenEXR is available for building 5.x for 5.x branch.
**File:** cmake/OpenCVFindOpenEXR.cmake
**Change Type:** modified
**Context:** PR #26678: build(4.x) OpenEXR 2.2 or earlier cannot be used with C++17 or later
**Review Line:** 154

**Code Changes:**
```diff
   if(NOT OPENEXR_VERSION)
     SET(OPENEXR_VERSION "Unknown")
+  else()
+    if(HAVE_CXX17 AND OPENEXR_VERSION VERSION_LESS "2.3.0")
+      message(STATUS "  OpenEXR(ver ${OPENEXR_VERSION}) doesn't support C++17 and higher. Updating OpenEXR 2.3.0+ is required.")
+      SET(OPENEXR_FOUND FALSE)
+    endif()
   endif()
 ELSE()
   IF(OPENEXR_FIND_REQUIRED)
```

Review comment:
OpenCV members seems do not consider to support/update bundled OpenEXR. I think bundled OpenEXR third party library will be dropped for 5.x branch in the furure. So this is hard to be solution for combination C++ Standard and OpenEXR version. See https://github.com/opencv/opencv/pull/21324#issuecomment-1305925279
**File:** samples/cpp/tutorial_code/ImgTrans/HoughLines_Demo.cpp
**Change Type:** modified
**Context:** PR #26815: Replaced sprintf with snprintf

**Code Changes:**
```diff
@@ -71,8 +71,7 @@ int main( int argc, char** argv )
    namedWindow( probabilistic_name, WINDOW_AUTOSIZE );
    createTrackbar( thresh_label, probabilistic_name, &p_trackbar, max_trackbar, Probabilistic_Hough );
 
-   char edge_thresh_label[50];
-   sprintf( edge_thresh_label, "Edge Thres: input" );
+   const char* edge_thresh_label = "Edge Thres: input";
    namedWindow( weighted_name, WINDOW_AUTOSIZE);
    createTrackbar( edge_thresh_label, weighted_name, &e_trackbar, max_trackbar, Weighted_Hough);
    createTrackbar( thresh_label, weighted_name, &w_trackbar, weightedhough_max_trackbar, Weighted_Hough);
```

Review comment:
The string does not contain formatting options. It means that sprintf may be thrown away and the string constant used as is here.
**File:** samples/cpp/tutorial_code/ImgTrans/HoughLines_Demo.cpp
**Change Type:** modified
**Context:** PR #26815: Replaced sprintf with snprintf

**Code Changes:**
```diff
@@ -71,8 +71,7 @@ int main( int argc, char** argv )
    namedWindow( probabilistic_name, WINDOW_AUTOSIZE );
    createTrackbar( thresh_label, probabilistic_name, &p_trackbar, max_trackbar, Probabilistic_Hough );
 
-   char edge_thresh_label[50];
-   sprintf( edge_thresh_label, "Edge Thres: input" );
+   const char* edge_thresh_label = "Edge Thres: input";
    namedWindow( weighted_name, WINDOW_AUTOSIZE);
    createTrackbar( edge_thresh_label, weighted_name, &e_trackbar, max_trackbar, Weighted_Hough);
    createTrackbar( thresh_label, weighted_name, &w_trackbar, weightedhough_max_trackbar, Weighted_Hough);
```

Review comment:
just `const char* edge_thresh_label = "Edge Thres: input";` should be enough
**File:** modules/videoio/test/test_orientation.cpp
**Change Type:** modified
**Context:** PR #26800: fix default cap_prop_orientation_auto behaviour

**Code Changes:**
```diff
@@ -8,69 +8,80 @@ using namespace std;
 
 namespace opencv_test { namespace {
 
-typedef TestWithParam<cv::VideoCaptureAPIs> VideoCaptureAPITests;
+// PR: https://github.com/opencv/opencv/pull/26800
+// TODO: Enable the tests back on Windows after FFmpeg plugin rebuild
+#ifndef _WIN32
 
-// related issue: https://github.com/opencv/opencv/issues/15499
```

Review comment:
This test largely repeats the previous one, can we unify them?
**File:** modules/videoio/test/test_orientation.cpp
**Change Type:** modified
**Context:** PR #26800: fix default cap_prop_orientation_auto behaviour

**Code Changes:**
```diff
@@ -8,69 +8,80 @@ using namespace std;
 
 namespace opencv_test { namespace {
 
-typedef TestWithParam<cv::VideoCaptureAPIs> VideoCaptureAPITests;
+// PR: https://github.com/opencv/opencv/pull/26800
+// TODO: Enable the tests back on Windows after FFmpeg plugin rebuild
+#ifndef _WIN32
 
-// related issue: https://github.com/opencv/opencv/issues/15499
```

Review comment:
I think this will do. Good night
**File:** modules/videoio/test/test_orientation.cpp
**Change Type:** modified
**Context:** PR #26800: fix default cap_prop_orientation_auto behaviour

**Code Changes:**
```diff
@@ -8,69 +8,80 @@ using namespace std;
 
 namespace opencv_test { namespace {
 
-typedef TestWithParam<cv::VideoCaptureAPIs> VideoCaptureAPITests;
+// PR: https://github.com/opencv/opencv/pull/26800
+// TODO: Enable the tests back on Windows after FFmpeg plugin rebuild
+#ifndef _WIN32
 
-// related issue: https://github.com/opencv/opencv/issues/15499
```

Review comment:
Maybe it would be better to remove extra stdout prints.
**File:** modules/videoio/test/test_orientation.cpp
**Change Type:** modified
**Context:** PR #26800: fix default cap_prop_orientation_auto behaviour
**Review Line:** 68

**Code Changes:**
```diff
-    EXPECT_EQ(480, actual.width);
-    EXPECT_EQ(270, actual.height);
+TEST_P(VideoCaptureAPITests, mp4_orientation_switch)
+{
+    SCOPED_TRACE("Initial orientation with autorotation");
+    orientationCheck(90., 270, 480);
+    SCOPED_TRACE("Disabled autorotation");
+    EXPECT_TRUE(cap.set(CAP_PROP_ORIENTATION_AUTO, false));
+    EXPECT_FALSE(cap.get(CAP_PROP_ORIENTATION_AUTO));
+    orientationCheck(90., 480, 270);
+}
```

Review comment:
We should use `SCOPED_TRACE` to distinguish between failures before and after orientation switch.
**File:** modules/videoio/test/test_orientation.cpp
**Change Type:** modified
**Context:** PR #26800: fix default cap_prop_orientation_auto behaviour
**Review Line:** 37

**Code Changes:**
```diff
 
-    EXPECT_TRUE(cap.set(CAP_PROP_ORIENTATION_AUTO, true));
+    void orientationCheck(double angle, int width, int height)
+    {
+        EXPECT_EQ(angle, cap.get(CAP_PROP_ORIENTATION_META));
+        EXPECT_EQ(width, (int)cap.get(CAP_PROP_FRAME_WIDTH));
+        EXPECT_EQ(height, (int)cap.get(CAP_PROP_FRAME_HEIGHT));
 
-    Size actual;
-    EXPECT_NO_THROW(actual = Size((int)cap.get(CAP_PROP_FRAME_WIDTH),
-                                    (int)cap.get(CAP_PROP_FRAME_HEIGHT)));
```

Review comment:
Perhaps we can use cv::Size: ``` EXPECT_EQ(expectedSize, Size(cap.get(CAP_PROP_FRAME_WIDTH), cap.get(CAP_PROP_FRAME_HEIGHT)));
**File:** modules/imgproc/src/shapedescr.cpp
**Change Type:** modified
**Context:** PR #26773: Improve robustness for ellipse fitting

**Code Changes:**
```diff
@@ -340,9 +340,10 @@ double cv::contourArea( InputArray _contour, bool oriented )
 namespace cv
 {
 
-static inline Point2f getOfs(int i, float eps)
+static inline Point2f getOfs(float eps)
 {
-    return Point2f(((i & 1)*2 - 1)*eps, ((i & 2) - 1)*eps);
+    RNG& rng = theRNG();
+    return Point2f(rng.uniform(-eps, eps), rng.uniform(-eps, eps));
```

Review comment:
I propose to use cv::RNG for it to make it manageable outside: - User may set seed to get deterministic behaviour - OpenCV test system fixes cv::RNG seed for each test independently.
**File:** modules/imgproc/src/shapedescr.cpp
**Change Type:** modified
**Context:** PR #26773: Improve robustness for ellipse fitting

**Code Changes:**
```diff
@@ -340,9 +340,10 @@ double cv::contourArea( InputArray _contour, bool oriented )
 namespace cv
 {
 
-static inline Point2f getOfs(int i, float eps)
+static inline Point2f getOfs(float eps)
 {
-    return Point2f(((i & 1)*2 - 1)*eps, ((i & 2) - 1)*eps);
+    RNG& rng = theRNG();
+    return Point2f(rng.uniform(-eps, eps), rng.uniform(-eps, eps));
```

Review comment:
Used `cv::RNG`
**File:** modules/imgproc/src/filter.dispatch.cpp
**Change Type:** modified
**Context:** PR #26806: removal of unused variable `kernalDataUMat`

**Code Changes:**
```diff
@@ -592,7 +592,6 @@ static bool ocl_filter2D( InputArray _src, OutputArray _dst, int ddepth,
 
     // For smaller filter kernels, there is a special kernel that is more
     // efficient than the general one.
-    UMat kernalDataUMat;
     if (device.isIntel() && (device.type() & ocl::Device::TYPE_GPU) &&
         ((ksize.width < 5 && ksize.height < 5) ||
         (ksize.width == 5 && ksize.height == 5 && cn == 1)))
```

Review comment:
it seems that the variable is unused. what about removing it.
**File:** modules/imgcodecs/src/grfmt_jpegxl.cpp
**Change Type:** modified
**Context:** PR #26788: imgcodecs: jpegxl: support cv::IMREAD_UNCHANGED and other ImreadFlags

**Code Changes:**
```diff
@@ -12,6 +12,19 @@
 
 namespace cv
 {
+// Callback functions for JpegXLDecoder
+static void cbRGBtoBGR_8U(void *opaque, size_t x, size_t y, size_t num_pixels, const void *pixels);
+static void cbRGBAtoBGRA_8U(void *opaque, size_t x, size_t y, size_t num_pixels, const void *pixels);
+static void cbRGBtoBGR_16U(void *opaque, size_t x, size_t y, size_t num_pixels, const void *pixels);
+static void cbRGBAtoBGRA_16U(void *opaque, size_t x, size_t y, size_t num_pixels, const void *pixels);
+static void cbRGBtoBGR_32F(void *opaque, size_t x, size_t y, size_t num_pixels, const void *pixels);
```

Review comment:
It should be platform specific, right?
**File:** modules/imgcodecs/src/grfmt_jpegxl.cpp
**Change Type:** modified
**Context:** PR #26788: imgcodecs: jpegxl: support cv::IMREAD_UNCHANGED and other ImreadFlags

**Code Changes:**
```diff
@@ -12,6 +12,19 @@
 
 namespace cv
 {
+// Callback functions for JpegXLDecoder
+static void cbRGBtoBGR_8U(void *opaque, size_t x, size_t y, size_t num_pixels, const void *pixels);
+static void cbRGBAtoBGRA_8U(void *opaque, size_t x, size_t y, size_t num_pixels, const void *pixels);
+static void cbRGBtoBGR_16U(void *opaque, size_t x, size_t y, size_t num_pixels, const void *pixels);
+static void cbRGBAtoBGRA_16U(void *opaque, size_t x, size_t y, size_t num_pixels, const void *pixels);
+static void cbRGBtoBGR_32F(void *opaque, size_t x, size_t y, size_t num_pixels, const void *pixels);
```

Review comment:
The function behaviour depends on emptiness of the input Mat. For now it's not true, even if user mat is empty and allocated by caller side. IMHO the approach is dangerous and may be broken during refactoring or some redesign. I propose to split the concerns and introduce bool flag. It's almost free and makes the code more readable.
**File:** modules/imgcodecs/src/grfmt_jpegxl.cpp
**Change Type:** modified
**Context:** PR #26788: imgcodecs: jpegxl: support cv::IMREAD_UNCHANGED and other ImreadFlags

**Code Changes:**
```diff
@@ -12,6 +12,19 @@
 
 namespace cv
 {
+// Callback functions for JpegXLDecoder
+static void cbRGBtoBGR_8U(void *opaque, size_t x, size_t y, size_t num_pixels, const void *pixels);
+static void cbRGBAtoBGRA_8U(void *opaque, size_t x, size_t y, size_t num_pixels, const void *pixels);
+static void cbRGBtoBGR_16U(void *opaque, size_t x, size_t y, size_t num_pixels, const void *pixels);
+static void cbRGBAtoBGRA_16U(void *opaque, size_t x, size_t y, size_t num_pixels, const void *pixels);
+static void cbRGBtoBGR_32F(void *opaque, size_t x, size_t y, size_t num_pixels, const void *pixels);
```

Review comment:
Yes, I agree with you. And I refactor to remove argument variable for read() function. There are many changes, but I think it makes easier to fix and to modify.
**File:** doc/tutorials/introduction/macos_install/macos_install.markdown
**Change Type:** modified
**Context:** PR #26564: Improvement of macOS installation guide in documentation
**Review Line:** 80

**Code Changes:**
```diff
-@code{.bash}
-cd ~/<my_working_directory>
-git clone https://github.com/opencv/opencv.git
-git clone https://github.com/opencv/opencv_contrib.git
-@endcode
 Building OpenCV from Source Using CMake
 ---------------------------------------
 
 -#  Create a temporary directory, which we denote as `build_opencv`, where you want to put
     the generated Makefiles, project files as well the object files and output binaries and enter
     there.
```

Review comment:
Please restore empty line
**File:** doc/tutorials/introduction/macos_install/macos_install.markdown
**Change Type:** modified
**Context:** PR #26564: Improvement of macOS installation guide in documentation

**Code Changes:**
```diff
@@ -9,41 +9,49 @@ Installation in MacOS {#tutorial_macos_install}
 | Original author | `@sajarindider` |
 | Compatibility | OpenCV >= 3.4 |
 
-The following steps have been tested for MacOSX (Mavericks) but should work with other versions as well.
+The following steps have been tested for macOS (Mavericks) but should work with other versions as well.
 
 Required Packages
 -----------------
 
```

Review comment:
SIFT is included
**File:** doc/tutorials/introduction/macos_install/macos_install.markdown
**Change Type:** modified
**Context:** PR #26564: Improvement of macOS installation guide in documentation

**Code Changes:**
```diff
@@ -9,41 +9,49 @@ Installation in MacOS {#tutorial_macos_install}
 | Original author | `@sajarindider` |
 | Compatibility | OpenCV >= 3.4 |
 
-The following steps have been tested for MacOSX (Mavericks) but should work with other versions as well.
+The following steps have been tested for macOS (Mavericks) but should work with other versions as well.
 
 Required Packages
 -----------------
 
```

Review comment:
maybe just mention pip install opencv-contrib-python to use the extra modules
**File:** modules/videoio/include/opencv2/videoio.hpp
**Change Type:** modified
**Context:** PR #25584: Open VideoCapture from data stream

**Code Changes:**
```diff
@@ -719,6 +719,25 @@ enum VideoCaptureOBSensorProperties{
 
 //! @} videoio_flags_others
 
+/** @brief Read data stream interface
+ */
+class CV_EXPORTS_W IStreamReader
+{
+public:
+    virtual ~IStreamReader();
```

Review comment:
I would suggest to avoid this simple overload - functionality is advanced initially.
**File:** modules/videoio/include/opencv2/videoio.hpp
**Change Type:** modified
**Context:** PR #25584: Open VideoCapture from data stream

**Code Changes:**
```diff
@@ -719,6 +719,25 @@ enum VideoCaptureOBSensorProperties{
 
 //! @} videoio_flags_others
 
+/** @brief Read data stream interface
+ */
+class CV_EXPORTS_W IStreamReader
+{
+public:
+    virtual ~IStreamReader();
```

Review comment:
The same, drop simplified overload.
**File:** modules/videoio/src/plugin_capture_api.hpp
**Change Type:** modified
**Context:** PR #25584: Open VideoCapture from data stream

**Code Changes:**
```diff
@@ -13,7 +13,7 @@
 /// increased for backward-compatible changes, e.g. add new function
 /// Caller API <= Plugin API -> plugin is fully compatible
 /// Caller API > Plugin API -> plugin is not fully compatible, caller should use extra checks to use plugins with older API
-#define CAPTURE_API_VERSION 1
+#define CAPTURE_API_VERSION 2
 
 /// increased for incompatible changes, e.g. remove function argument
 /// Caller ABI == Plugin ABI -> plugin is compatible
@@ -121,6 +121,29 @@ struct OpenCV_VideoIO_Capture_Plugin_API_v1_1_api_entries
```

Review comment:
Do we really need to handle all 3 parameters for the source in a single method of API? As we keep the previous version of the method, then we don't need to duplicate its functionality.
**File:** modules/videoio/src/plugin_capture_api.hpp
**Change Type:** modified
**Context:** PR #25584: Open VideoCapture from data stream

**Code Changes:**
```diff
@@ -13,7 +13,7 @@
 /// increased for backward-compatible changes, e.g. add new function
 /// Caller API <= Plugin API -> plugin is fully compatible
 /// Caller API > Plugin API -> plugin is not fully compatible, caller should use extra checks to use plugins with older API
-#define CAPTURE_API_VERSION 1
+#define CAPTURE_API_VERSION 2
 
 /// increased for incompatible changes, e.g. remove function argument
 /// Caller ABI == Plugin ABI -> plugin is compatible
@@ -121,6 +121,29 @@ struct OpenCV_VideoIO_Capture_Plugin_API_v1_1_api_entries
```

Review comment:
Sorry for delay. Changed to a method which accepts only buffer. Wanted to add GStreamer backend but couldn't make it work for now.
**File:** modules/videoio/src/plugin_capture_api.hpp
**Change Type:** modified
**Context:** PR #25584: Open VideoCapture from data stream

**Code Changes:**
```diff
@@ -13,7 +13,7 @@
 /// increased for backward-compatible changes, e.g. add new function
 /// Caller API <= Plugin API -> plugin is fully compatible
 /// Caller API > Plugin API -> plugin is not fully compatible, caller should use extra checks to use plugins with older API
-#define CAPTURE_API_VERSION 1
+#define CAPTURE_API_VERSION 2
 
 /// increased for incompatible changes, e.g. remove function argument
 /// Caller ABI == Plugin ABI -> plugin is compatible
@@ -121,6 +121,29 @@ struct OpenCV_VideoIO_Capture_Plugin_API_v1_1_api_entries
```

Review comment:
We should not pass C++ objects through low level plugin API. They are not usable in general. Different C++ ABIs are possible for OpenCV and plugin parts: - MSVS vs MinGW - GCC/Clang with different C++ standards - libc++ (GCC) / libstdc++ (Clang)
**File:** modules/videoio/misc/python/pyopencv_videoio.hpp
**Change Type:** modified
**Context:** PR #25584: Open VideoCapture from data stream

**Code Changes:**
```diff
@@ -31,4 +31,114 @@ template<> bool pyopencv_to(PyObject* obj, cv::VideoCapture& stream, const ArgIn
     return true;
 }
 
+class PythonStreamReader : public cv::IStreamReader
+{
+public:
+    PythonStreamReader(PyObject* _obj = nullptr) : obj(_obj)
+    {
+        if (obj)
```

Review comment:
Is that ok to have relative import path? I don't want to move `CvStream` to public API
**File:** modules/videoio/misc/python/pyopencv_videoio.hpp
**Change Type:** modified
**Context:** PR #25584: Open VideoCapture from data stream

**Code Changes:**
```diff
@@ -31,4 +31,114 @@ template<> bool pyopencv_to(PyObject* obj, cv::VideoCapture& stream, const ArgIn
     return true;
 }
 
+class PythonStreamReader : public cv::IStreamReader
+{
+public:
+    PythonStreamReader(PyObject* _obj = nullptr) : obj(_obj)
+    {
+        if (obj)
```

Review comment:
This approach might not work with [standalone](https://github.com/opencv/opencv/blob/4.x/modules/python/standalone.cmake) python bindings build or some other special configuration. As an alternative you can make it "technically" public by moving class declaration to a `.private.hpp` header like we do with [avi container](https://github.com/opencv/opencv/blob/4.x/modules/videoio/include/opencv2/videoio/container_avi.private.hpp) - symbols will be exported, but header will not be installed.
**File:** modules/videoio/src/plugin_capture_api.hpp
**Change Type:** modified
**Context:** PR #25584: Open VideoCapture from data stream

**Code Changes:**
```diff
@@ -13,7 +13,7 @@
 /// increased for backward-compatible changes, e.g. add new function
 /// Caller API <= Plugin API -> plugin is fully compatible
 /// Caller API > Plugin API -> plugin is not fully compatible, caller should use extra checks to use plugins with older API
-#define CAPTURE_API_VERSION 1
+#define CAPTURE_API_VERSION 2
 
 /// increased for incompatible changes, e.g. remove function argument
 /// Caller ABI == Plugin ABI -> plugin is compatible
@@ -121,6 +121,29 @@ struct OpenCV_VideoIO_Capture_Plugin_API_v1_1_api_entries
```

Review comment:
- [x] Update docstring with new arguments
**File:** modules/videoio/include/opencv2/videoio/utils.private.hpp
**Change Type:** modified
**Context:** PR #25584: Open VideoCapture from data stream

**Code Changes:**
```diff
@@ -10,6 +10,37 @@
 
 namespace cv {
 CV_EXPORTS std::string icvExtractPattern(const std::string& filename, unsigned *offset);
+
+class PluginStreamReader : public IStreamReader
+{
+public:
+    PluginStreamReader(void* _opaque,
+                       long long (*_read)(void* opaque, char* buffer, long long size),
```

Review comment:
`Cv` is a prefix of legacy C-API.
**File:** modules/videoio/misc/python/pyopencv_videoio.hpp
**Change Type:** modified
**Context:** PR #25584: Open VideoCapture from data stream

**Code Changes:**
```diff
@@ -31,4 +31,114 @@ template<> bool pyopencv_to(PyObject* obj, cv::VideoCapture& stream, const ArgIn
     return true;
 }
 
+class PythonStreamReader : public cv::IStreamReader
+{
+public:
+    PythonStreamReader(PyObject* _obj = nullptr) : obj(_obj)
+    {
+        if (obj)
```

Review comment:
We don't really want to investigate problems caused by this. It looks like `#define true false` Python generator should be adopted instead.
**File:** modules/videoio/src/backend_plugin.cpp
**Change Type:** modified
**Context:** PR #25584: Open VideoCapture from data stream

**Code Changes:**
```diff
@@ -208,6 +208,7 @@ class PluginBackend: public IBackend
     Ptr<IVideoCapture> createCapture(int camera, const VideoCaptureParameters& params) const CV_OVERRIDE;
     Ptr<IVideoCapture> createCapture(const std::string &filename) const;
     Ptr<IVideoCapture> createCapture(const std::string &filename, const VideoCaptureParameters& params) const CV_OVERRIDE;
+    Ptr<IVideoCapture> createCapture(const Ptr<IStreamReader>& stream, const VideoCaptureParameters& params) const CV_OVERRIDE;
     Ptr<IVideoWriter> createWriter(const std::string& filename, int fourcc, double fps,
                                    const cv::Size& sz, const VideoWriterParameters& params) const CV_OVERRIDE;
 
@@ -447,16 +448,52 @@ class PluginCapture : public cv::IVideoCapture
 {
```

Review comment:
No need to use `std::streambuf` anywhere in API. We need to use internally just simplified class which provides seek/read **interface**. Public API should have simple converter from this.
**File:** modules/videoio/src/cap_ffmpeg.cpp
**Change Type:** modified
**Context:** PR #25584: Open VideoCapture from data stream

**Code Changes:**
```diff
@@ -74,6 +74,11 @@ class CvCapture_FFMPEG_proxy CV_FINAL : public cv::VideoCaptureBase
     {
         open(filename, params);
     }
+    CvCapture_FFMPEG_proxy(const Ptr<IStreamReader>& stream, const cv::VideoCaptureParameters& params)
+        : ffmpegCapture(NULL)
+    {
+        open(stream, params);
+    }
     virtual ~CvCapture_FFMPEG_proxy() { close(); }
```

Review comment:
Where do we seek to zero after this check?
**File:** modules/videoio/src/videoio_registry.hpp
**Change Type:** modified
**Context:** PR #25584: Open VideoCapture from data stream

**Code Changes:**
```diff
@@ -14,6 +14,7 @@ namespace cv
 enum BackendMode {
     MODE_CAPTURE_BY_INDEX    = 1 << 0,           //!< device index
     MODE_CAPTURE_BY_FILENAME = 1 << 1,           //!< filename or device path (v4l2)
+    MODE_CAPTURE_BY_STREAM   = 1 << 2,           //!< data stream
     MODE_WRITER              = 1 << 4,            //!< writer
 
     MODE_CAPTURE_ALL = MODE_CAPTURE_BY_INDEX + MODE_CAPTURE_BY_FILENAME,
@@ -38,6 +39,7 @@ namespace videoio_registry {
 
```

Review comment:
`BY_STREAM`
**File:** modules/videoio/src/cap_ffmpeg.cpp
**Change Type:** modified
**Context:** PR #25584: Open VideoCapture from data stream

**Code Changes:**
```diff
@@ -74,6 +74,11 @@ class CvCapture_FFMPEG_proxy CV_FINAL : public cv::VideoCaptureBase
     {
         open(filename, params);
     }
+    CvCapture_FFMPEG_proxy(const Ptr<IStreamReader>& stream, const cv::VideoCaptureParameters& params)
+        : ffmpegCapture(NULL)
+    {
+        open(stream, params);
+    }
     virtual ~CvCapture_FFMPEG_proxy() { close(); }
```

Review comment:
`sgetc` does not modify sequence position. I also worried about that but checked again