////////////////////////////////////////////////////////
//! @ImsMDrivePlusMotorController()
//! Constructor
//! Driver assumes only 1 axis configured per controller for now...
//!
//! @param[in] motorPortName Name assigned to the port created to communicate with the motor
//! @param[in] IOPortName Name assigned to the asyn IO port, name that was assigned in drvAsynIPPortConfigure()
//! @param[in] devName Name of device (DN) assigned to motor axis in MCode, the device name is prepended to the MCode command to support Party Mode (PY) multidrop communication setup
//! set to empty string "" if no device name needed/not using Party Mode
//! @param[in] movingPollPeriod Moving polling period in milliseconds
//! @param[in] idlePollPeriod Idle polling period in milliseconds
////////////////////////////////////////////////////////
ImsMDrivePlusMotorController::ImsMDrivePlusMotorController(const char *motorPortName, const char *IOPortName, const char *devName, double movingPollPeriod, double idlePollPeriod)
: asynMotorController(motorPortName, NUM_AXES, NUM_IMS_PARAMS,
asynInt32Mask | asynFloat64Mask | asynUInt32DigitalMask,
asynInt32Mask | asynFloat64Mask | asynUInt32DigitalMask,
ASYN_CANBLOCK | ASYN_MULTIDEVICE,
1, // autoconnect
0, 0), // Default priority and stack size
pAsynUserIMS(0)
{
static const char *functionName = "ImsMDrivePlusMotorController()";
asynStatus status;
ImsMDrivePlusMotorAxis *pAxis;
// asynMotorController constructor calloc's memory for array of axis pointers
pAxes_ = (ImsMDrivePlusMotorAxis **)(asynMotorController::pAxes_);
// copy names
strcpy(motorName, motorPortName);
// setup communication
status = pasynOctetSyncIO->connect(IOPortName, 0, &pAsynUserIMS, NULL);
if (status != asynSuccess) {
printf("\n\n%s:%s: ERROR connecting to Controller's IO port=%s\n\n", DRIVER_NAME, functionName, IOPortName);
// TODO would be good to implement exceptions
// TODO THROW_(SmarActMCSException(MCSConnectionError, "SmarActMCSController: unable to connect serial channel"));
}
// write version, cannot use asynPrint() in constructor since controller (motorPortName) hasn't been created yet
printf("%s:%s: motorPortName=%s, IOPortName=%s, devName=%s \n", DRIVER_NAME, functionName, motorPortName, IOPortName, devName);
// init
pasynOctetSyncIO->setInputEos(pAsynUserIMS, "\n", 1);
pasynOctetSyncIO->setOutputEos(pAsynUserIMS, "\r\n", 2);
// Create controller-specific parameters
createParam(ImsMDrivePlusSaveToNVMControlString, asynParamInt32, &ImsMDrivePlusSaveToNVM_);
createParam(ImsMDrivePlusLoadMCodeControlString, asynParamOctet, &this->ImsMDrivePlusLoadMCode_);
createParam(ImsMDrivePlusClearMCodeControlString, asynParamOctet, &this->ImsMDrivePlusClearMCode_);
// Check the validity of the arguments and init controller object
initController(devName, movingPollPeriod, idlePollPeriod);
// Create axis
// Assuming single axis per controller the way drvAsynIPPortConfigure( "M06", "ts-b34-nw08:2101", 0, 0 0 ) is called in st.cmd script
pAxis = new ImsMDrivePlusMotorAxis(this, 0);
pAxis = NULL; // asynMotorController constructor tracking array of axis pointers
// read home and limit config from S1-S4
readHomeAndLimitConfig();
startPoller(movingPollPeriod, idlePollPeriod, 2);
}
/** Constructor for NDPluginAttribute; most parameters are simply passed to NDPluginDriver::NDPluginDriver.
*
* \param[in] portName The name of the asyn port driver to be created.
* \param[in] queueSize The number of NDArrays that the input queue for this plugin can hold when
* NDPluginDriverBlockingCallbacks=0. Larger queues can decrease the number of dropped arrays,
* at the expense of more NDArray buffers being allocated from the underlying driver's NDArrayPool.
* \param[in] blockingCallbacks Initial setting for the NDPluginDriverBlockingCallbacks flag.
* 0=callbacks are queued and executed by the callback thread; 1 callbacks execute in the thread
* of the driver doing the callbacks.
* \param[in] NDArrayPort Name of asyn port driver for initial source of NDArray callbacks.
* \param[in] NDArrayAddr asyn port driver address for initial source of NDArray callbacks.
* \param[in] maxAttributes The maximum number of attributes that this plugin will support
* \param[in] maxBuffers The maximum number of NDArray buffers that the NDArrayPool for this driver is
* allowed to allocate. Set this to -1 to allow an unlimited number of buffers.
* \param[in] maxMemory The maximum amount of memory that the NDArrayPool for this driver is
* allowed to allocate. Set this to -1 to allow an unlimited amount of memory.
* \param[in] priority The thread priority for the asyn port driver thread if ASYN_CANBLOCK is set in asynFlags.
* \param[in] stackSize The stack size for the asyn port driver thread if ASYN_CANBLOCK is set in asynFlags.
*/
NDPluginAttribute::NDPluginAttribute(const char *portName, int queueSize, int blockingCallbacks,
const char *NDArrayPort, int NDArrayAddr, int maxAttributes,
int maxBuffers, size_t maxMemory,
int priority, int stackSize)
/* Invoke the base class constructor */
: NDPluginDriver(portName, queueSize, blockingCallbacks,
NDArrayPort, NDArrayAddr, maxAttributes, maxBuffers, maxMemory,
asynInt32ArrayMask | asynFloat64Mask | asynFloat64ArrayMask | asynGenericPointerMask,
asynInt32ArrayMask | asynFloat64Mask | asynFloat64ArrayMask | asynGenericPointerMask,
ASYN_MULTIDEVICE, 1, priority, stackSize, 1)
{
int i;
static const char *functionName = "NDPluginAttribute::NDPluginAttribute";
maxAttributes_ = maxAttributes;
if (maxAttributes_ < 1) maxAttributes_ = 1;
/* parameters */
createParam(NDPluginAttributeAttrNameString, asynParamOctet, &NDPluginAttributeAttrName);
createParam(NDPluginAttributeResetString, asynParamInt32, &NDPluginAttributeReset);
createParam(NDPluginAttributeValString, asynParamFloat64, &NDPluginAttributeVal);
createParam(NDPluginAttributeValSumString, asynParamFloat64, &NDPluginAttributeValSum);
createParam(NDPluginAttributeTSControlString, asynParamInt32, &NDPluginAttributeTSControl);
createParam(NDPluginAttributeTSNumPointsString, asynParamInt32, &NDPluginAttributeTSNumPoints);
createParam(NDPluginAttributeTSCurrentPointString, asynParamInt32, &NDPluginAttributeTSCurrentPoint);
createParam(NDPluginAttributeTSAcquiringString, asynParamInt32, &NDPluginAttributeTSAcquiring);
createParam(NDPluginAttributeTSArrayValueString, asynParamFloat64Array, &NDPluginAttributeTSArrayValue);
/* Set the plugin type string */
setStringParam(NDPluginDriverPluginType, "NDPluginAttribute");
setIntegerParam(NDPluginAttributeTSNumPoints, DEFAULT_NUM_TSPOINTS);
pTSArray_ = static_cast<epicsFloat64 **>(calloc(maxAttributes_, sizeof(epicsFloat64 *)));
if (pTSArray_ == NULL) {
perror(functionName);
asynPrint(this->pasynUserSelf, ASYN_TRACE_ERROR, "%s: Error from calloc for pTSArray_.\n", functionName);
}
for (i=0; i<maxAttributes_; i++) {
pTSArray_[i] = static_cast<epicsFloat64*>(calloc(DEFAULT_NUM_TSPOINTS, sizeof(epicsFloat64)));
setDoubleParam(i, NDPluginAttributeVal, 0.0);
setDoubleParam(i, NDPluginAttributeValSum, 0.0);
setStringParam(i, NDPluginAttributeAttrName, "");
if (pTSArray_[i] == NULL) {
perror(functionName);
asynPrint(this->pasynUserSelf, ASYN_TRACE_ERROR, "%s: Error from calloc for pTSArray_.\n", functionName);
}
callParamCallbacks(i);
}
// Disable ArrayCallbacks.
// This plugin currently does not do array callbacks, so make the setting reflect the behavior
setIntegerParam(NDArrayCallbacks, 0);
/* Try to connect to the array port */
connectToArrayPort();
}
/** Constructor for NDPluginAttribute; most parameters are simply passed to NDPluginDriver::NDPluginDriver.
*
* \param[in] portName The name of the asyn port driver to be created.
* \param[in] queueSize The number of NDArrays that the input queue for this plugin can hold when
* NDPluginDriverBlockingCallbacks=0. Larger queues can decrease the number of dropped arrays,
* at the expense of more NDArray buffers being allocated from the underlying driver's NDArrayPool.
* \param[in] blockingCallbacks Initial setting for the NDPluginDriverBlockingCallbacks flag.
* 0=callbacks are queued and executed by the callback thread; 1 callbacks execute in the thread
* of the driver doing the callbacks.
* \param[in] NDArrayPort Name of asyn port driver for initial source of NDArray callbacks.
* \param[in] NDArrayAddr asyn port driver address for initial source of NDArray callbacks.
* \param[in] maxBuffers The maximum number of NDArray buffers that the NDArrayPool for this driver is
* allowed to allocate. Set this to -1 to allow an unlimited number of buffers.
* \param[in] maxMemory The maximum amount of memory that the NDArrayPool for this driver is
* allowed to allocate. Set this to -1 to allow an unlimited amount of memory.
* \param[in] priority The thread priority for the asyn port driver thread if ASYN_CANBLOCK is set in asynFlags.
* \param[in] stackSize The stack size for the asyn port driver thread if ASYN_CANBLOCK is set in asynFlags.
* \param[in] maxTimeSeries The max size of the time series array
* \param[in] attrName The name of the NDArray attribute
*/
NDPluginAttribute::NDPluginAttribute(const char *portName, int queueSize, int blockingCallbacks,
const char *NDArrayPort, int NDArrayAddr,
int maxBuffers, size_t maxMemory,
int priority, int stackSize,
int maxTimeSeries, const char *attrName)
/* Invoke the base class constructor */
: NDPluginDriver(portName, queueSize, blockingCallbacks,
NDArrayPort, NDArrayAddr, 1, NUM_NDPLUGIN_ATTR_PARAMS, maxBuffers, maxMemory,
asynInt32ArrayMask | asynFloat64Mask | asynFloat64ArrayMask | asynGenericPointerMask,
asynInt32ArrayMask | asynFloat64Mask | asynFloat64ArrayMask | asynGenericPointerMask,
ASYN_MULTIDEVICE, 1, priority, stackSize)
{
static const char *functionName = "NDPluginAttribute::NDPluginAttribute";
/* parameters */
createParam(NDPluginAttributeNameString, asynParamOctet, &NDPluginAttributeName);
createParam(NDPluginAttributeAttrNameString, asynParamOctet, &NDPluginAttributeAttrName);
createParam(NDPluginAttributeResetString, asynParamInt32, &NDPluginAttributeReset);
createParam(NDPluginAttributeUpdateString, asynParamInt32, &NDPluginAttributeUpdate);
createParam(NDPluginAttributeValString, asynParamFloat64, &NDPluginAttributeVal);
createParam(NDPluginAttributeValSumString, asynParamFloat64, &NDPluginAttributeValSum);
createParam(NDPluginAttributeArrayString, asynParamFloat64Array, &NDPluginAttributeArray);
createParam(NDPluginAttributeDataTypeString, asynParamInt32, &NDPluginAttributeDataType);
createParam(NDPluginAttributeUpdatePeriodString, asynParamFloat64, &NDPluginAttributeUpdatePeriod);
/* Set the plugin type string */
setStringParam(NDPluginDriverPluginType, "NDPluginAttribute");
maxTimeSeries_ = maxTimeSeries;
pTimeSeries_ = static_cast<epicsFloat64*>(calloc(maxTimeSeries_, sizeof(epicsFloat64)));
if (pTimeSeries_ == NULL) {
perror(functionName);
asynPrint(this->pasynUserSelf, ASYN_TRACE_ERROR, "%s: Error from calloc for pTimeSeries_.\n", functionName);
}
currentPoint_ = 0;
arrayUpdate_ = 1;
valueSum_ = 0.0;
/* Set the attribute name */
/* This can be set at runtime too.*/
setStringParam(NDPluginAttributeAttrName, attrName);
setDoubleParam(NDPluginAttributeVal, 0.0);
setDoubleParam(NDPluginAttributeValSum, 0.0);
/* Try to connect to the array port */
connectToArrayPort();
callParamCallbacks();
}
// Create one parameter for an outlined function
// return the created parameter
SgInitializedName* createOneFunctionParameter(const SgInitializedName* i_name,
bool readOnly,
SgFunctionDeclaration* func)
{
ROSE_ASSERT (i_name);
ROSE_ASSERT (func);
SgFunctionParameterList* params = func->get_parameterList ();
ROSE_ASSERT (params);
SgFunctionDefinition* def = func->get_definition ();
ROSE_ASSERT (def);
// It handles language-specific details internally, like pass-by-value, pass-by-reference
// name and type is not enough, need the SgInitializedName also for tell
// if an array comes from a parameter list
OutlinedFuncParam_t param = createParam (i_name,readOnly);
SgName p_sg_name (param.first.c_str ());
// name, type, declaration, scope,
// TODO function definition's declaration should not be passed to createInitName()
SgInitializedName* p_init_name = createInitName (param.first, param.second, def->get_declaration(), def);
ROSE_ASSERT (p_init_name);
prependArg(params,p_init_name);
return p_init_name;
}
开发者ID:8l,项目名称:rose,代码行数:28,代码来源:CudaOutliner.C
示例8: guard
//////////////////////////////////////////////////////////////////////////////////////////////////
// //
// void CLeyboldSimPortDriver::addIOPort(const char* IOPortName) //
// //
// Description: //
// Called once (from LeyboldSimAddIOPort) for each pump, //
// in response to the st.cmd startup script. //
// Adds a pump, and the parameters to support it, to the configuration. //
// //
//////////////////////////////////////////////////////////////////////////////////////////////////
void CLeyboldSimPortDriver::addIOPort(const char* IOPortName)
{
epicsGuard < epicsMutex > guard ( CLeyboldSimPortDriver::m_Mutex );
for (size_t ParamIndex = 0; ParamIndex < size_t(NUM_PARAMS); ParamIndex++)
{
if (ParameterDefns[ParamIndex].m_UseCase == NotForSim)
// Not implemented, because not meaningful for the simulater.
continue;
if (ParameterDefns[ParamIndex].m_UseCase == Single)
// Single instance parameter
continue;
createParam(m_asynUsers.size(), ParamIndex);
}
setDefaultValues(m_asynUsers.size());
setIntegerParam(m_asynUsers.size(), FAULT, 0);
asynUser *asynUser = pasynManager->createAsynUser(0,0);
m_TableLookup[IOPortName] = m_asynUsers.size();
m_asynUsers.push_back(asynUser);
asynStatus Status = pasynManager->connectDevice(asynUser, IOPortName, int(m_asynUsers.size()));
if (Status != asynSuccess)
throw CException(asynUser, Status, __FUNCTION__, "connectDevice" + std::string(IOPortName));
asynInterface* pasynOctetInterface = pasynManager->findInterface(asynUser, asynOctetType, 1);
asynOctet* Octet = (asynOctet*)pasynOctetInterface->pinterface;
void *pinterruptNode;
Octet->registerInterruptUser(pasynOctetInterface->drvPvt, asynUser, octetConnectionCallback, this, &pinterruptNode);
}
/** Constructor for NDPluginTransform; most parameters are simply passed to NDPluginDriver::NDPluginDriver.
* After calling the base class constructor this method sets reasonable default values for all of the
* Transform parameters.
* \param[in] portName The name of the asyn port driver to be created.
* \param[in] queueSize The number of NDArrays that the input queue for this plugin can hold when
* NDPluginDriverBlockingCallbacks=0. Larger queues can decrease the number of dropped arrays,
* at the expense of more NDArray buffers being allocated from the underlying driver's NDArrayPool.
* \param[in] blockingCallbacks Initial setting for the NDPluginDriverBlockingCallbacks flag.
* 0=callbacks are queued and executed by the callback thread; 1 callbacks execute in the thread
* of the driver doing the callbacks.
* \param[in] NDArrayPort Name of asyn port driver for initial source of NDArray callbacks.
* \param[in] NDArrayAddr asyn port driver address for initial source of NDArray callbacks.
* \param[in] maxBuffers The maximum number of NDArray buffers that the NDArrayPool for this driver is
* allowed to allocate. Set this to -1 to allow an unlimited number of buffers.
* \param[in] maxMemory The maximum amount of memory that the NDArrayPool for this driver is
* allowed to allocate. Set this to -1 to allow an unlimited amount of memory.
* \param[in] priority The thread priority for the asyn port driver thread if ASYN_CANBLOCK is set in asynFlags.
* \param[in] stackSize The stack size for the asyn port driver thread if ASYN_CANBLOCK is set in asynFlags.
*/
NDPluginTransform::NDPluginTransform(const char *portName, int queueSize, int blockingCallbacks,
const char *NDArrayPort, int NDArrayAddr, int maxBuffers, size_t maxMemory,
int priority, int stackSize)
/* Invoke the base class constructor */
: NDPluginDriver(portName, queueSize, blockingCallbacks,
NDArrayPort, NDArrayAddr, 1, NUM_TRANSFORM_PARAMS, maxBuffers, maxMemory,
asynInt32ArrayMask | asynFloat64ArrayMask | asynGenericPointerMask,
asynInt32ArrayMask | asynFloat64ArrayMask | asynGenericPointerMask,
ASYN_MULTIDEVICE, 1, priority, stackSize)
{
//static const char *functionName = "NDPluginTransform";
int i;
createParam(NDPluginTransformTypeString, asynParamInt32, &NDPluginTransformType_);
for (i = 0; i < ND_ARRAY_MAX_DIMS; i++) {
this->userDims_[i] = i;
}
/* Set the plugin type string */
setStringParam(NDPluginDriverPluginType, "NDPluginTransform");
setIntegerParam(NDPluginTransformType_, TransformNone);
/* Try to connect to the array port */
connectToArrayPort();
}
/** Constructor for NDFileJPEG; all parameters are simply passed to NDPluginFile::NDPluginFile.
* \param[in] portName The name of the asyn port driver to be created.
* \param[in] queueSize The number of NDArrays that the input queue for this plugin can hold when
* NDPluginDriverBlockingCallbacks=0. Larger queues can decrease the number of dropped arrays,
* at the expense of more NDArray buffers being allocated from the underlying driver's NDArrayPool.
* \param[in] blockingCallbacks Initial setting for the NDPluginDriverBlockingCallbacks flag.
* 0=callbacks are queued and executed by the callback thread; 1 callbacks execute in the thread
* of the driver doing the callbacks.
* \param[in] NDArrayPort Name of asyn port driver for initial source of NDArray callbacks.
* \param[in] NDArrayAddr asyn port driver address for initial source of NDArray callbacks.
* \param[in] priority The thread priority for the asyn port driver thread if ASYN_CANBLOCK is set in asynFlags.
* \param[in] stackSize The stack size for the asyn port driver thread if ASYN_CANBLOCK is set in asynFlags.
*/
NDFileJPEG::NDFileJPEG(const char *portName, int queueSize, int blockingCallbacks,
const char *NDArrayPort, int NDArrayAddr,
int priority, int stackSize)
/* Invoke the base class constructor.
* We allocate 2 NDArrays of unlimited size in the NDArray pool.
* This driver can block (because writing a file can be slow), and it is not multi-device.
* Set autoconnect to 1. priority and stacksize can be 0, which will use defaults. */
: NDPluginFile(portName, queueSize, blockingCallbacks,
NDArrayPort, NDArrayAddr, 1, NUM_NDFILE_JPEG_PARAMS,
2, 0, asynGenericPointerMask, asynGenericPointerMask,
ASYN_CANBLOCK, 1, priority, stackSize)
{
//static const char *functionName = "NDFileJPEG";
createParam(NDFileJPEGQualityString, asynParamInt32, &NDFileJPEGQuality);
jpeg_create_compress(&this->jpegInfo);
this->jpegInfo.err = jpeg_std_error(&this->jpegErr);
/* Note: we don't use the built-in stdio routines, because this does not work when using
* the prebuilt library and either VC++ or g++ on Windows. The FILE pointers are wrong
* when doing that. Rather we implement our own jpeg_destination_mgr structure and handle
* the I/O ourselves. The code we use is almost a direct copy from jdatadst.c in the standard
* package. */
this->destMgr.pub.init_destination = init_destination;
this->destMgr.pub.empty_output_buffer = empty_output_buffer;
this->destMgr.pub.term_destination = term_destination;
this->destMgr.pNDFileJPEG = this;
this->jpegInfo.dest = (jpeg_destination_mgr *) &this->destMgr;
/* Set the plugin type string */
setStringParam(NDPluginDriverPluginType, "NDFileJPEG");
this->supportsMultipleArrays = 0;
setIntegerParam(NDFileJPEGQuality, 50);
}
/** Constructor for NDPluginStdArrays; all parameters are simply passed to NDPluginDriver::NDPluginDriver.
* This plugin cannot block (ASYN_CANBLOCK=0) and is not multi-device (ASYN_MULTIDEVICE=0).
* It allocates a maximum of 2 NDArray buffers for internal use.
* \param[in] portName The name of the asyn port driver to be created.
* \param[in] queueSize The number of NDArrays that the input queue for this plugin can hold when
* NDPluginDriverBlockingCallbacks=0. Larger queues can decrease the number of dropped arrays,
* at the expense of more NDArray buffers being allocated from the underlying driver's NDArrayPool.
* \param[in] blockingCallbacks Initial setting for the NDPluginDriverBlockingCallbacks flag.
* 0=callbacks are queued and executed by the callback thread; 1 callbacks execute in the thread
* of the driver doing the callbacks.
* \param[in] NDArrayPort Name of asyn port driver for initial source of NDArray callbacks.
* \param[in] NDArrayAddr asyn port driver address for initial source of NDArray callbacks.
* \param[in] maxMemory The maximum amount of memory that the NDArrayPool for this driver is
* allowed to allocate. Set this to -1 to allow an unlimited amount of memory.
* \param[in] priority The thread priority for the asyn port driver thread if ASYN_CANBLOCK is set in asynFlags.
* \param[in] stackSize The stack size for the asyn port driver thread if ASYN_CANBLOCK is set in asynFlags.
*/
NDPluginStdArrays::NDPluginStdArrays(const char *portName, int queueSize, int blockingCallbacks,
const char *NDArrayPort, int NDArrayAddr, size_t maxMemory,
int priority, int stackSize)
/* Invoke the base class constructor */
: NDPluginDriver(portName, queueSize, blockingCallbacks,
NDArrayPort, NDArrayAddr, 1, NUM_NDPLUGIN_STDARRAYS_PARAMS, 2, maxMemory,
asynInt8ArrayMask | asynInt16ArrayMask | asynInt32ArrayMask |
asynFloat32ArrayMask | asynFloat64ArrayMask,
asynInt8ArrayMask | asynInt16ArrayMask | asynInt32ArrayMask |
asynFloat32ArrayMask | asynFloat64ArrayMask,
/* asynFlags is set to 0, because this plugin cannot block and is not multi-device.
* It does autoconnect */
0, 1, priority, stackSize)
{
//static const char *functionName = "NDPluginStdArrays";
createParam(NDPluginStdArraysDataString, asynParamGenericPointer, &NDPluginStdArraysData);
/* Set the plugin type string */
setStringParam(NDPluginDriverPluginType, "NDPluginStdArrays");
// Disable ArrayCallbacks.
// This plugin currently does not do array callbacks, so make the setting reflect the behavior
setIntegerParam(NDArrayCallbacks, 0);
/* Try to connect to the NDArray port */
connectToArrayPort();
}
/** Constructor for ffmpegFile; all parameters are simply passed to NDPluginFile::NDPluginFile.
ffmpegFileConfigure() should be used to create an instance in the iocsh.
See ffmpegStream.template for more details of usage.
* \param[in] portName The name of the asyn port driver to be created.
* \param[in] queueSize The number of NDArrays that the input queue for this plugin can hold when
* NDPluginDriverBlockingCallbacks=0. Larger queues can decrease the number of dropped arrays,
* at the expense of more NDArray buffers being allocated from the underlying driver's NDArrayPool.
* \param[in] blockingCallbacks Initial setting for the NDPluginDriverBlockingCallbacks flag.
* 0=callbacks are queued and executed by the callback thread; 1 callbacks execute in the thread
* of the driver doing the callbacks.
* \param[in] NDArrayPort Name of asyn port driver for initial source of NDArray callbacks.
* \param[in] NDArrayAddr asyn port driver address for initial source of NDArray callbacks.
* \param[in] priority The thread priority for the asyn port driver thread if ASYN_CANBLOCK is set in asynFlags.
* \param[in] stackSize The stack size for the asyn port driver thread if ASYN_CANBLOCK is set in asynFlags.
*/
ffmpegFile::ffmpegFile(const char *portName, int queueSize, int blockingCallbacks,
const char *NDArrayPort, int NDArrayAddr,
int priority, int stackSize)
/* Invoke the base class constructor.
* We allocate 2 NDArrays of unlimited size in the NDArray pool.
* This driver can block (because writing a file can be slow), and it is not multi-device.
* Set autoconnect to 1. priority can be 0, which will use defaults.
* We require a minimum stacksize of 128k for windows-x64 */
: NDPluginFile(portName, queueSize, blockingCallbacks,
NDArrayPort, NDArrayAddr, 1,
2, 0, asynGenericPointerMask, asynGenericPointerMask,
ASYN_CANBLOCK, 1, priority, stackSize < 128000 ? 128000 : stackSize, 1)
{
//const char *functionName = "ffmpegFile";
createParam(ffmpegFileBitrateString, asynParamFloat64, &ffmpegFileBitrate);
createParam(ffmpegFileFPSString, asynParamInt32, &ffmpegFileFPS);
createParam(ffmpegFileHeightString, asynParamInt32, &ffmpegFileHeight);
createParam(ffmpegFileWidthString, asynParamInt32, &ffmpegFileWidth);
/* Set the plugin type string */
setStringParam(NDPluginDriverPluginType, "ffmpegFile");
this->supportsMultipleArrays = 0;
/* Initialise the ffmpeg library */
ffmpegInitialise();
this->ctx = NULL;
this->outFile = NULL;
this->codec = NULL;
this->c = NULL;
this->inPicture = NULL;
this->scPicture = NULL;
this->scArray = NULL;
this->outArray = NULL;
this->ctx = NULL;
this->fmt = NULL;
this->oc = NULL;
this->video_st = NULL;
}
请发表评论