areaDetector  3-5-0
EPICS areaDetector framework
ffmpegFile.h
Go to the documentation of this file.
1 #ifndef ffmpegFile_H
2 #define ffmpegFile_H
3 
4 #include "NDPluginFile.h"
5 #include "ffmpegCommon.h"
6 #ifdef WIN32
7 #define snprintf _snprintf
8 #endif
9 
10 #define ffmpegFileBitrateString "FFMPEG_BITRATE" /* (asynFloat64, r/w) File bitrate */
11 #define ffmpegFileFPSString "FFMPEG_FPS" /* (asynInt32, r/w) Frames per second */
12 #define ffmpegFileHeightString "FFMPEG_HEIGHT" /* (asynInt32, r/w) Video Height */
13 #define ffmpegFileWidthString "FFMPEG_WIDTH" /* (asynInt32, r/w) Video Width */
14 
15 /* Minimum integer exactly representable in IEEE 754 double (-2^53) */
16 #define EXACT_INT_DBL_MIN -9007199254740992.0
17 /* Maximum integer exactly representable in IEEE 754 double (2^53) */
18 #define EXACT_INT_DBL_MAX 9007199254740992.0
19 
22 class ffmpegFile : public NDPluginFile {
23 public:
24  ffmpegFile(const char *portName, int queueSize, int blockingCallbacks,
25  const char *NDArrayPort, int NDArrayAddr,
26  int priority, int stackSize);
27  /* The methods that this class implements */
28  virtual asynStatus openFile(const char *fileName, NDFileOpenMode_t openMode, NDArray *pArray);
29  virtual asynStatus readFile(NDArray **pArray);
30  virtual asynStatus writeFile(NDArray *pArray);
31  virtual asynStatus closeFile();
32  virtual asynStatus writeFloat64(asynUser *pasynUser, epicsFloat64 value);
33 
34 protected:
36  #define FIRST_FFMPEG_FILE_PARAM ffmpegFileBitrate
40  #define LAST_FFMPEG_FILE_PARAM ffmpegFileWidth
41 
42 private:
43  FILE *outFile;
44  AVCodec *codec;
45  enum AVCodecID codec_id;
46  AVCodecContext *c;
47  AVFrame *inPicture;
48  AVFrame *scPicture;
49  NDArray *scArray;
50  NDArray *outArray;
51  struct SwsContext *ctx;
52  size_t outSize;
53  int needStop;
54  int sheight, swidth;
55  enum AVPixelFormat spix_fmt;
56  AVOutputFormat *fmt;
57  AVFormatContext *oc;
58  AVStream *video_st;
59  double video_pts;
60 };
61 #define NUM_FFMPEG_FILE_PARAMS (int)(&LAST_FFMPEG_FILE_PARAM - &FIRST_FFMPEG_FILE_PARAM + 1)
62 
63 #endif
64 
virtual asynStatus closeFile()
Closes the ffmpeg file.
Definition: ffmpegFile.cpp:297
int ffmpegFileFPS
Definition: ffmpegFile.h:37
virtual asynStatus writeFile(NDArray *pArray)
Writes single NDArray to the ffmpeg file.
Definition: ffmpegFile.cpp:225
list value
Definition: makeDbAndEdl.py:234
int ffmpegFileBitrate
Definition: ffmpegFile.h:35
int ffmpegFileWidth
Definition: ffmpegFile.h:39
char * portName
The name of this asyn port.
Definition: asynPortDriver.h:179
virtual asynStatus readFile(NDArray **pArray)
Reads single NDArray from a ffmpeg file; NOT CURRENTLY IMPLEMENTED.
Definition: ffmpegFile.cpp:288
Writes NDArrays to a ffmpeg file.
Definition: ffmpegFile.h:22
ffmpegFile(const char *portName, int queueSize, int blockingCallbacks, const char *NDArrayPort, int NDArrayAddr, int priority, int stackSize)
Constructor for ffmpegFile; all parameters are simply passed to NDPluginFile::NDPluginFile.
Definition: ffmpegFile.cpp:387
virtual asynStatus openFile(const char *fileName, NDFileOpenMode_t openMode, NDArray *pArray)
Opens an FFMPEG file.
Definition: ffmpegFile.cpp:19
N-dimensional array class; each array has a set of dimensions, a data type, pointer to data,...
Definition: NDArray.h:92
int NDFileOpenMode_t
Definition: NDPluginFile.h:17
int ffmpegFileHeight
Definition: ffmpegFile.h:38
Base class for NDArray file writing plugins; actual file writing plugins inherit from this class.
Definition: NDPluginFile.h:28
virtual asynStatus writeFloat64(asynUser *pasynUser, epicsFloat64 value)
Called when asyn clients call pasynFloat64->write().
Definition: ffmpegFile.cpp:351