![]() |
![]() |
![]() |
DVD Player
/usr/photon/bin/dvdplayer
The DVD player plugin, dvdplayer, is based on the Xing DVD Player. It plays DVDs and supports:
While playing a DVD, the plugin behaves like a multitrack program. Individual chapters of the DVD represent the tracks.
Calling MvInit() sets the value of MvPluginCtrl_t.MvPluginFlags_t pflags to MV_HASDFLTURL, but this is for the DVD operation. You can still play files using the CMD_PLUGIN_OPEN_URLS command. The URL can be set to dvd on an CMD_PLUGIN_OPEN_URLS to tell the plugin to use DVD mode.
See the Resource Profile Estimates and Library Dependencies appendix.
Valid commands for the DVD player plugin are:
CMD_PLUGIN_ANGLE
CMD_PLUGIN_BOOKMARK_SET
CMD_PLUGIN_CLOSE
CMD_PLUGIN_DIRECT_AUDIO
CMD_PLUGIN_GET_STATUS
CMD_PLUGIN_KARAOKE_MIX
CMD_PLUGIN_KARAOKE_RECORD
CMD_PLUGIN_MENU
CMD_PLUGIN_MUTE
CMD_PLUGIN_OPEN_URLS
CMD_PLUGIN_PAUSE
CMD_PLUGIN_REVERSE_PLAY
CMD_PLUGIN_SCAN_BACK
CMD_PLUGIN_SCAN_FORWARD
CMD_PLUGIN_SEEK_RELATIVE
CMD_PLUGIN_SEEK_TO
CMD_PLUGIN_SELECT
CMD_PLUGIN_SELECT_AUDIO
CMD_PLUGIN_SELECT_DOWN
CMD_PLUGIN_SELECT_LEFT
CMD_PLUGIN_SELECT_RIGHT
CMD_PLUGIN_SELECT_SUBTITLE
CMD_PLUGIN_SELECT_UP
CMD_PLUGIN_SEND_MESSAGE
CMD_PLUGIN_SET_PARAMETER
CMD_PLUGIN_SET_WINDOW
CMD_PLUGIN_SLOW_MOTION
CMD_PLUGIN_START
CMD_PLUGIN_STEP
CMD_PLUGIN_STOP
This sample callback handler is used by phplay to analyze state changes and status information. After verifying that the plugin handle is still valid, the value of the MvEventFlags_t change variable is examined to determine which field of the MvPluginStatus_t const *pst structure is valid.
Values that may be used for MvEventFlags_t change include:
MVS_AUDIO_LIST
MVS_DISPLAY_INFO
MVS_DURATION
MVS_ERRORMSG
MVS_FLAGS
MVS_MEDIA
MVS_PLUGIN_STATE
MVS_POSITION
MVS_SUBTITLE_LIST
MVS_VPSIZE
void dvd_vcb( MvPluginCtrl_t *ctrl, MvEventFlags_t change, MvPluginStatus_t const *pst ) { PtArg_t args[2]; const char *status = "No plugin"; if( mplayer.pctrl == NULL ) { //this plugin has been closed if( pst->state == MV_DEAD ) { // plugin is ready for destruction UnloadDll( ctrl ); free( ctrl ); // reset plugin count mplayer.pluginIsLoaded = FALSE; } // show the correct pause/play button SetPlayPauseButton( TRUE ); return; } /* CHECK IF PLUGIN STATE HAS CHANGE */ if( change & MVS_PLUGIN_STATE ) { //plugin state has change MvCommandData_t cmdData = {0}; switch( pst->state ) { case MV_DEAD: status ="Dead"; mplayer.pluginIsLoaded = FALSE; SetStopEjectButton( FALSE ); cbBaseClose( 0, 0, 0 ); return; case MV_CLOSED: status = ( mplayer.pctrl->lastst == MV_OPENING ) ? "Open failed" : "No Clip"; break; case MV_OPENING: status = "Opening"; break; case MV_STOPPED: status = ( mplayer.pctrl->lastst == MV_OPENING ) ? "Opened" : "Stopped"; mplayer.played = 0; cmdData.pluginCtrl = &mplayer.pctrl->mv; cmdData.cmdType = CMD_PLUGIN_SEEK_TO; cmdData.which = MVP_DELTA | MVP_POSITION; cmdData.param = &mplayer.playback_parms; mplayer.playback_parms.delta = 0; mplayer.playback_parms.position = 0; mplayer.pctrl->mv.calls->command( &cmdData ); if( mplayer.playIsSet ) { if (ControllerGetRepeatType()== MV_REPEAT_THIS_TRACK || mplayer.pctrl->lastst == MV_OPENING) { PtTimerArm( ABW_pausePlayButton, 500 ); } } break; case MV_PAUSED: status = "Paused"; break; case MV_PREFETCHING: status = "Prefetching"; break; case MV_PLAYING: status = "Playing"; mplayer.played = 1; break; case MV_PLAYBW: status = "Reverse Play"; break; case MV_SCANFW: status = "Scanning Forward"; break; case MV_SCANBW: status = "Scanning Backwards"; break; case MV_STEP: status = "Stepping"; break; case MV_SLOW: status = "Slow Motion"; break; default: status = "Unknown"; break; } setbuttons( pst->state); // update mplayer state flag mplayer.pctrl->lastst = pst->state; //update DVD state label with new state PtSetArg( &args[0], Pt_ARG_TEXT_STRING, status, 0 ); PtSetResources( ABW_dvd_stateLabel, 1, args ); } /* CHECK IF PLUGIN STATUS FLAG HAS CHANGE */ if( change & MVS_FLAGS ) {// flags is valid. mplayer.pctrl->psflags = pst->flags; } /* CHECK IF PLUGIN WANT TO RESIZE VIDEO WINDOW */ if( change & MVS_MEDIA ) { if( mplayer.pctrl->lastst >= MV_STOPPED ) { if( pst->media_info->which & MV_MEDIA_VIDEO_INFO ) { mplayer.vin = *pst->media_info->video; if( pst->flags & MVS_AREA ) { // set video window size to new value specified by plugin if( mplayer.playback_parms.video_wgt && mplayer.setup.videoSetting.bKeepAspectRatio && !mplayer.setup.bHomeEntertainment) { //fprintf(stderr,"Ang in %s resizing video window to x = %d y = %d w = %d h = %d\n", //__FILE__,mplayer.vin.area.pos.x,mplayer.vin.area.pos.y,mplayer.vin.area.size.w,mplayer.vin.area.size.h); PtSetArg( &args[0], Pt_ARG_DIM, &mplayer.vin.area.size, 0 ); PtSetResources( ABW_video, 1, args ); } return; } } } } /* CHECK IF PLUGIN WANT TO ADJUST PHPLAY VOLUME SETTING */ if( change & MVS_MEDIA ) { if( pst->media_info->which & MV_MEDIA_AUDIO_INFO ) { PtSetArg( &args[0], Pt_ARG_GAUGE_VALUE, pst->media_info->audio->volume, 0 ); PtSetResources( ABW_PtSlider_volume, 1, args ); return; } } /* CHECK IF PLUGIN MEDIA INFO IS VALID */ if( change & MVS_MEDIA ) // media_info is valid and points to new media { if( mplayer.pctrl->lastst >= MV_STOPPED ) {// last state was MV_STOPPED or MV_PAUSED or MV_PREFETCHING or MV_PLAYING const char* title = pst->media_info->title; if( title == NULL ) { title = ( title = strrchr( pst->media_info->url, '/' ) ) ? ++title : pst->media_info->url; } mplayer.pctrl->mediaType = pst->media_info->type; mplayer.pctrl->duration = pst->media_info->duration; //was if( mplayer.pctrl->mediaType & MV_MEDIA_VIDEO ) if( pst->media_info->which & MV_MEDIA_VIDEO_INFO ) { mplayer.vin = *pst->media_info->video; } if( mplayer.pctrl->mediaType & MV_MEDIA_SEEKABLE && mplayer.pctrl->duration ) { PtSetArg( &args[0], Pt_ARG_FLAGS, 0, Pt_BLOCKED | Pt_GHOST ); PtSetResources( ABW_curpos, 1, args ); } if( pst->media_info->type & MV_MEDIA_PLAYLIST ) { // the plugin new media info is a playlist int track; ControllerGetPluginList(); track = ControllerGetActiveTrack(); ControllerOpenIndex( NULL, track ); } else { int track; MvCommandData_t cmdData = {0}; // the new plugin media info is not a play list track = ControllerAddUrl( pst->media_info->url, pst->media_info->title, FALSE ); ControllerSetActiveTrack( track ); PtSetArg( &args[0], Pt_ARG_TEXT_STRING, ControllerGetActiveUrl() , 0 ); PtSetResources( ABW_baseInfo, 1, args ); // repositioning of the widget to show beginning of time frame PtSetArg( &args[0], Pt_ARG_GAUGE_VALUE, 0, 0 ); PtSetResources( ABW_curpos, 1, args ); if(( mplayer.playback_parms.status_frequency = mplayer.pctrl->duration / POS_SLIDER_WIDTH ) > 100 ) { mplayer.playback_parms.status_frequency = 100; } cmdData.pluginCtrl = &mplayer.pctrl->mv; cmdData.cmdType = CMD_PLUGIN_SET_PARAMETER; cmdData.which = MVP_STATUS_FREQ; cmdData.param = &mplayer.playback_parms; mplayer.pctrl->mv.calls->command( &cmdData ); } } else {// last state was MV_DEAD or MV_CLOSED or MV_OPENING // reset GUI cursor position PtSetArg( &args[0], Pt_ARG_GAUGE_VALUE, 0, 0 ); PtSetResources( ABW_curpos, 1, args ); //set_curpos_bg( 0 ); // make it impossible to move the cursor from the GUI PtSetArg( &args[0], Pt_ARG_FLAGS, ~0, Pt_BLOCKED | Pt_GHOST ); PtSetResources( ABW_curpos, 1, args ); } } /* CHECK IF PLUGIN POSITION IS VALID */ if( change & MVS_POSITION ) { // position is valid plassert( mplayer.pctrl->duration != 0, "MVS_POSITION is set although duration is 0" ); if( !( mplayer.cursorIsDrag ) ) { // update background cursor position mplayer.pctrl->lastpos = pst->position; // update cursor position PtSetArg( &args[0], Pt_ARG_GAUGE_VALUE, pst->position, 0 ); PtSetResources( ABW_curpos, 1, args ); DvdUpdatePosition( pst->position, mplayer.pctrl->duration ); } } /* CHECK IF PLUGIN DURATION IS VALID */ if( change & MVS_DURATION ) { //adjust the maximum range of the progress bar widget mplayer.pctrl->duration = pst->duration; PtSetArg( &args[0], Pt_ARG_GAUGE_MAXIMUM, pst->duration, 0 ); PtSetResources( ABW_curpos, 1, args ); } /* CHECK IF PLUGIN HAS AN ERROR MESSAGE */ if( change & MVS_ERRORMSG ) { // there's an error message in errmsg popup_error( pst->errormsg ); mplayer.pluginIsLoaded = FALSE; cbBaseClose( 0, 0, 0 ); return; } /* CHECK IF DVDPLAYER REQUEST MPLAYER TO UPDATE DVD GUI */ if( change & MVS_DISPLAY_INFO ) { PtArg_t arg; PtSetArg( &arg, Pt_ARG_TEXT_STRING,pst->displayInfo->title , 0 ); PtSetResources( ABW_dvd_titleLabel, 1, &arg ); PtSetArg( &arg, Pt_ARG_TEXT_STRING,pst->displayInfo->chapter , 0 ); PtSetResources( ABW_dvd_chapterLabel, 1, &arg ); PtSetArg( &arg, Pt_ARG_TEXT_STRING,pst->displayInfo->angle , 0 ); PtSetResources( ABW_dvd_angleLabel, 1, &arg ); } /* CHECK IF PLUGIN AUDIO LIST IS VALID */ if( change & MVS_AUDIO_LIST ) { PtArg_t arg; PtListDeleteAllItems( ABW_dvd_audioComboBox ); PtListAddItems( ABW_dvd_audioComboBox, (const char**) pst->audioList->list, pst->audioList->count, 0 ); PtSetArg( &arg, Pt_ARG_CBOX_SEL_ITEM, (const char**) pst->audioList->selectedIndex , 0 ); PtSetResources( ABW_dvd_audioComboBox, 1, &arg ); } /* CHECK IF PLUGIN SUBTITLE LIST IS VALID */ if( change & MVS_SUBTITLE_LIST ) { PtArg_t arg; char* str= "None"; PtListDeleteAllItems( ABW_dvd_subtitleComboBox ); PtListAddItems( ABW_dvd_subtitleComboBox, (const char**) pst->subtitleList->list, pst->subtitleList->count, 0 ); PtListAddItems( ABW_dvd_subtitleComboBox, (const char**) &str, 1, 1); PtSetArg( &arg, Pt_ARG_CBOX_SEL_ITEM, pst->subtitleList->selectedIndex + 1 , 0 ); PtSetResources( ABW_dvd_subtitleComboBox, 1, &arg ); } }
![]() |
![]() |
![]() |