Operating systems, development tools, and professional services
for connected embedded systems
for connected embedded systems
![]() |
![]() |
![]() |
Appendix: A Simple Plugin Example
![]() |
A code sample of a phplay plugin is in /usr/free/neutrino/multimedia/phabplugin1.tgz |
Overview of Phabplugin1.so:
- Uses GUI pane inside of plugin
- There's no use of extproc.so
- QNX Media API 1.1 is required
- src/gcc_ntox86 has:
- mpregistry
- testfile.pl1
- README
Plugin example
int MvInit( MvPluginCtrl_t *pc )
{
MvPluginData_t *pd;
pctrl = pc;
if( ( pd = malloc(sizeof(*pd)) ) == NULL )
{
return -1;
}
memset( pd, 0, sizeof(*pd) );
pc->pdata = pd;
pc->calls = &calls;
pc->pflags = MV_SPANE | MV_HASDFLTURL;
// initialize phap : path = full pathname to this dll
ApAddContext( &AbContext, pc->name );
return 0;
}
This function's dispatch command comes from mplayer and is sent to the appropriate plugin function handler:
static int command( MvCommandData_t *cmdData ) { int return_code = -1 ; PtArg_t arg; char* string; MvPluginData_t *pd = cmdData->pluginCtrl->pdata; switch( cmdData->cmdType ) { case CMD_PLUGIN_OPEN_URLS: string = " Plugin received :CMD_PLUGIN_OPEN_URLS\n"; return_code = 0; break; case CMD_PLUGIN_CLOSE: string = " Plugin received :CMD_PLUGIN_CLOSE\n"; return_code = 0; break; case CMD_PLUGIN_START: string = " Plugin received :CMD_PLUGIN_START\n"; return_code = 0; break; /* CUT OUT LOTS */ default: string = "Plugin Received an Unknown Message\n"; return_code = -1; break; } fprintf(stderr,string); PtSetArg( &arg, Pt_ARG_TEXT_STRING, string, 0 ); PtSetResources( ABW_status_label, 1, &arg ); return return_code; } static MvMediaInfo_t const* get_item( MvPluginCtrl_t *pc, MvMediaInfoFlag_t which, unsigned index ) { MvPluginData_t *pd = pc->pdata; fprintf(stderr,"Plugin received command get item\n"); if( which == MV_MEDIA_INFO ) { // get item and return it if index is valid } return NULL; } static void terminate( MvPluginCtrl_t *pc ) { MvPluginData_t *pd = pc->pdata; MvPluginStatus_t pluginStatus = {0}; fprintf(stderr, " Plugin received command to terminate\n"); //do some cleanup free( pd ); //phab cleanup ApRemoveContext( &AbContext ); // notify phplay that we're done pluginStatus.state = MV_DEAD; pc->cb( pc, MVS_PLUGIN_STATE , &pluginStatus ); } int plugin_set_params( MvPluginCtrl_t *pc, MvPlaybackParam_t which, MvPlaybackParams_t *param ) { MvPluginData_t *pd; PtArg_t arg; pd = pc->pdata; if( which & MVP_SPANE_WGT ) { PhDim_t dim; if( param->spane_wgt && (param->spane_wgt != pd->container_wgt) ) { pd->container_wgt = (PtWidget_t*) param->spane_wgt; ApCreateModule( ABM_spane, pd->container_wgt, NULL ); } //extract container widget dimension PtWidgetDim( pd->container_wgt, &dim ); // resize GUI to fit //PtSetArg( &arg, Pt_ARG_DIM, &dim , 0 ); //PtSetResources( ABW_plugin_gui, 1, &arg ); //update width PtNumericInteger widget PtSetArg( &arg, Pt_ARG_NUMERIC_VALUE, dim.w, 0); PtSetResources( ABW_pane_width, 1, &arg); //update height PtNumericInteger widget PtSetArg( &arg, Pt_ARG_NUMERIC_VALUE, dim.h, 0); PtSetResources( ABW_pane_height, 1, &arg); //PtExtentWidget( pd->container_wgt ); PtReRealizeWidget( pd->container_wgt ); } return 0; }
![]() |
![]() |
![]() |

![[Previous]](prev.gif)
![[Contents]](contents.gif)
![[Next]](next.gif)
