Path: blob/master/modules/videoio/src/cap_ffmpeg_api.hpp
16339 views
#ifndef __OPENCV_FFMPEG_H__1#define __OPENCV_FFMPEG_H__23#ifdef __cplusplus4extern "C"5{6#endif78#if defined _WIN329# define OPENCV_FFMPEG_API __declspec(dllexport)10#elif defined __GNUC__ && __GNUC__ >= 411# define OPENCV_FFMPEG_API __attribute__ ((visibility ("default")))12#else13# define OPENCV_FFMPEG_API14#endif1516enum17{18CV_FFMPEG_CAP_PROP_POS_MSEC=0,19CV_FFMPEG_CAP_PROP_POS_FRAMES=1,20CV_FFMPEG_CAP_PROP_POS_AVI_RATIO=2,21CV_FFMPEG_CAP_PROP_FRAME_WIDTH=3,22CV_FFMPEG_CAP_PROP_FRAME_HEIGHT=4,23CV_FFMPEG_CAP_PROP_FPS=5,24CV_FFMPEG_CAP_PROP_FOURCC=6,25CV_FFMPEG_CAP_PROP_FRAME_COUNT=7,26CV_FFMPEG_CAP_PROP_SAR_NUM=40,27CV_FFMPEG_CAP_PROP_SAR_DEN=4128};2930typedef struct CvCapture_FFMPEG CvCapture_FFMPEG;31typedef struct CvVideoWriter_FFMPEG CvVideoWriter_FFMPEG;3233OPENCV_FFMPEG_API struct CvCapture_FFMPEG* cvCreateFileCapture_FFMPEG(const char* filename);34OPENCV_FFMPEG_API int cvSetCaptureProperty_FFMPEG(struct CvCapture_FFMPEG* cap,35int prop, double value);36OPENCV_FFMPEG_API double cvGetCaptureProperty_FFMPEG(struct CvCapture_FFMPEG* cap, int prop);37OPENCV_FFMPEG_API int cvGrabFrame_FFMPEG(struct CvCapture_FFMPEG* cap);38OPENCV_FFMPEG_API int cvRetrieveFrame_FFMPEG(struct CvCapture_FFMPEG* capture, unsigned char** data,39int* step, int* width, int* height, int* cn);40OPENCV_FFMPEG_API void cvReleaseCapture_FFMPEG(struct CvCapture_FFMPEG** cap);4142OPENCV_FFMPEG_API struct CvVideoWriter_FFMPEG* cvCreateVideoWriter_FFMPEG(const char* filename,43int fourcc, double fps, int width, int height, int isColor );44OPENCV_FFMPEG_API int cvWriteFrame_FFMPEG(struct CvVideoWriter_FFMPEG* writer, const unsigned char* data,45int step, int width, int height, int cn, int origin);46OPENCV_FFMPEG_API void cvReleaseVideoWriter_FFMPEG(struct CvVideoWriter_FFMPEG** writer);4748typedef CvCapture_FFMPEG* (*CvCreateFileCapture_Plugin)( const char* filename );49typedef CvCapture_FFMPEG* (*CvCreateCameraCapture_Plugin)( int index );50typedef int (*CvGrabFrame_Plugin)( CvCapture_FFMPEG* capture_handle );51typedef int (*CvRetrieveFrame_Plugin)( CvCapture_FFMPEG* capture_handle, unsigned char** data, int* step,52int* width, int* height, int* cn );53typedef int (*CvSetCaptureProperty_Plugin)( CvCapture_FFMPEG* capture_handle, int prop_id, double value );54typedef double (*CvGetCaptureProperty_Plugin)( CvCapture_FFMPEG* capture_handle, int prop_id );55typedef void (*CvReleaseCapture_Plugin)( CvCapture_FFMPEG** capture_handle );56typedef CvVideoWriter_FFMPEG* (*CvCreateVideoWriter_Plugin)( const char* filename, int fourcc,57double fps, int width, int height, int iscolor );58typedef int (*CvWriteFrame_Plugin)( CvVideoWriter_FFMPEG* writer_handle, const unsigned char* data, int step,59int width, int height, int cn, int origin);60typedef void (*CvReleaseVideoWriter_Plugin)( CvVideoWriter_FFMPEG** writer );6162/*63* For CUDA encoder64*/6566OPENCV_FFMPEG_API struct OutputMediaStream_FFMPEG* create_OutputMediaStream_FFMPEG(const char* fileName, int width, int height, double fps);67OPENCV_FFMPEG_API void release_OutputMediaStream_FFMPEG(struct OutputMediaStream_FFMPEG* stream);68OPENCV_FFMPEG_API void write_OutputMediaStream_FFMPEG(struct OutputMediaStream_FFMPEG* stream, unsigned char* data, int size, int keyFrame);6970typedef struct OutputMediaStream_FFMPEG* (*Create_OutputMediaStream_FFMPEG_Plugin)(const char* fileName, int width, int height, double fps);71typedef void (*Release_OutputMediaStream_FFMPEG_Plugin)(struct OutputMediaStream_FFMPEG* stream);72typedef void (*Write_OutputMediaStream_FFMPEG_Plugin)(struct OutputMediaStream_FFMPEG* stream, unsigned char* data, int size, int keyFrame);7374/*75* For CUDA decoder76*/7778OPENCV_FFMPEG_API struct InputMediaStream_FFMPEG* create_InputMediaStream_FFMPEG(const char* fileName, int* codec, int* chroma_format, int* width, int* height);79OPENCV_FFMPEG_API void release_InputMediaStream_FFMPEG(struct InputMediaStream_FFMPEG* stream);80OPENCV_FFMPEG_API int read_InputMediaStream_FFMPEG(struct InputMediaStream_FFMPEG* stream, unsigned char** data, int* size, int* endOfFile);8182typedef struct InputMediaStream_FFMPEG* (*Create_InputMediaStream_FFMPEG_Plugin)(const char* fileName, int* codec, int* chroma_format, int* width, int* height);83typedef void (*Release_InputMediaStream_FFMPEG_Plugin)(struct InputMediaStream_FFMPEG* stream);84typedef int (*Read_InputMediaStream_FFMPEG_Plugin)(struct InputMediaStream_FFMPEG* stream, unsigned char** data, int* size, int* endOfFile);8586#ifdef __cplusplus87}88#endif8990#endif919293