Skip to content

Commit

Permalink
fixup! videoio/FFmpeg: added CV_16UC1 read/write support
Browse files Browse the repository at this point in the history
  • Loading branch information
mshabunin committed Dec 6, 2022
1 parent c35f800 commit cf511c7
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
3 changes: 2 additions & 1 deletion modules/videoio/src/cap_ffmpeg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
#define icvReleaseCapture_FFMPEG_p cvReleaseCapture_FFMPEG
#define icvGrabFrame_FFMPEG_p cvGrabFrame_FFMPEG
#define icvRetrieveFrame_FFMPEG_p cvRetrieveFrame_FFMPEG
#define icvRetrieveFrame2_FFMPEG_p cvRetrieveFrame2_FFMPEG
#define icvSetCaptureProperty_FFMPEG_p cvSetCaptureProperty_FFMPEG
#define icvGetCaptureProperty_FFMPEG_p cvGetCaptureProperty_FFMPEG
#define icvCreateVideoWriter_FFMPEG_p cvCreateVideoWriter_FFMPEG
Expand Down Expand Up @@ -103,7 +104,7 @@ class CvCapture_FFMPEG_proxy CV_FINAL : public cv::IVideoCapture
}

if (flag == 0) {
if (!icvRetrieveFrame_FFMPEG_p(ffmpegCapture, &data, &step, &width, &height, &cn, &depth))
if (!icvRetrieveFrame2_FFMPEG_p(ffmpegCapture, &data, &step, &width, &height, &cn, &depth))
return false;
}
else {
Expand Down
10 changes: 8 additions & 2 deletions modules/videoio/src/cap_ffmpeg_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,7 @@ struct CvCapture_FFMPEG
double getProperty(int) const;
bool setProperty(int, double);
bool grabFrame();
bool retrieveFrame(int flag, unsigned char** data, int* step, int* width, int* height, int* cn, int* deptth);
bool retrieveFrame(int flag, unsigned char** data, int* step, int* width, int* height, int* cn, int* depth);
bool retrieveHWFrame(cv::OutputArray output);
void rotateFrame(cv::Mat &mat) const;

Expand Down Expand Up @@ -3210,7 +3210,13 @@ int cvGrabFrame_FFMPEG(CvCapture_FFMPEG* capture)
return capture->grabFrame();
}

int cvRetrieveFrame_FFMPEG(CvCapture_FFMPEG* capture, unsigned char** data, int* step, int* width, int* height, int* cn, int* depth)
int cvRetrieveFrame_FFMPEG(CvCapture_FFMPEG* capture, unsigned char** data, int* step, int* width, int* height, int* cn)
{
int depth = CV_8U;
return cvRetrieveFrame2_FFMPEG(capture, data, step, width, height, cn, &depth);
}

int cvRetrieveFrame2_FFMPEG(CvCapture_FFMPEG* capture, unsigned char** data, int* step, int* width, int* height, int* cn, int* depth)
{
return capture->retrieveFrame(0, data, step, width, height, cn, depth);
}
Expand Down
4 changes: 3 additions & 1 deletion modules/videoio/src/cap_ffmpeg_legacy_api.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ OPENCV_FFMPEG_API int cvSetCaptureProperty_FFMPEG(struct CvCapture_FFMPEG* cap,
OPENCV_FFMPEG_API double cvGetCaptureProperty_FFMPEG(struct CvCapture_FFMPEG* cap, int prop);
OPENCV_FFMPEG_API int cvGrabFrame_FFMPEG(struct CvCapture_FFMPEG* cap);
OPENCV_FFMPEG_API int cvRetrieveFrame_FFMPEG(struct CvCapture_FFMPEG* capture, unsigned char** data,
int* step, int* width, int* height, int* cn, int* depth);
int* step, int* width, int* height, int* cn);
OPENCV_FFMPEG_API int cvRetrieveFrame2_FFMPEG(struct CvCapture_FFMPEG* capture, unsigned char** data,
int* step, int* width, int* height, int* cn, int* depth);
OPENCV_FFMPEG_API void cvReleaseCapture_FFMPEG(struct CvCapture_FFMPEG** cap);

OPENCV_FFMPEG_API struct CvVideoWriter_FFMPEG* cvCreateVideoWriter_FFMPEG(const char* filename,
Expand Down

0 comments on commit cf511c7

Please sign in to comment.