ffmpegFile.h

Go to the documentation of this file.
00001 #ifndef ffmpegFile_H
00002 #define ffmpegFile_H
00003 
00004 #include "NDPluginFile.h"
00005 #include "ffmpegCommon.h"
00006 #ifdef WIN32
00007 #define snprintf _snprintf
00008 #endif
00009 
00010 #define ffmpegFileBitrateString "FFMPEG_BITRATE"  /* (asynInt32, r/w) File bitrate */
00011 #define ffmpegFileFPSString     "FFMPEG_FPS"      /* (asynInt32, r/w) Frames per second */
00012 #define ffmpegFileHeightString  "FFMPEG_HEIGHT"   /* (asynInt32, r/w) Video Height */
00013 #define ffmpegFileWidthString   "FFMPEG_WIDTH"    /* (asynInt32, r/w) Video Width */
00014 
00017 class ffmpegFile : public NDPluginFile {
00018 public:
00019     ffmpegFile(const char *portName, int queueSize, int blockingCallbacks,
00020                const char *NDArrayPort, int NDArrayAddr,
00021                int priority, int stackSize);
00022     /* The methods that this class implements */
00023     virtual asynStatus openFile(const char *fileName, NDFileOpenMode_t openMode, NDArray *pArray);
00024     virtual asynStatus readFile(NDArray **pArray);
00025     virtual asynStatus writeFile(NDArray *pArray);
00026     virtual asynStatus closeFile();
00027 
00028 protected:
00029     int ffmpegFileBitrate;
00030     #define FIRST_FFMPEG_FILE_PARAM ffmpegFileBitrate
00031     int ffmpegFileFPS;
00032     int ffmpegFileHeight;
00033     int ffmpegFileWidth;
00034     #define LAST_FFMPEG_FILE_PARAM ffmpegFileWidth
00035 
00036 private:
00037     FILE *outFile;
00038     AVCodec *codec;
00039     AVCodecContext *c;
00040     AVFrame *inPicture;
00041     AVFrame *scPicture;    
00042     NDArray *scArray;
00043     NDArray *outArray;
00044     struct SwsContext *ctx;      
00045     size_t outSize;
00046     int needStop;      
00047     int sheight, swidth;
00048     PixelFormat spix_fmt;
00049     AVOutputFormat *fmt;
00050     AVFormatContext *oc;
00051     AVStream *video_st;
00052     double video_pts;   
00053 };
00054 #define NUM_FFMPEG_FILE_PARAMS (&LAST_FFMPEG_FILE_PARAM - &FIRST_FFMPEG_FILE_PARAM + 1)   
00055 
00056 #endif
00057 
 All Classes Files Functions Variables Defines