How to program a DVD-player?

hi every one,
please help me program DVD-player
thanks,
Tuyn

That’s a bit broad. All DVD-players I’ve seen use an IDE connector. Like CD-ROM drives, I believe they use the ATAPI interface, which is built on top of the EIDE interface. The QNX driver already deals with this level of interface, so you should be able to read a data disk. From what I’ve seen, Video DVD disks are just data disks with specific directories and files on them. Decoding the video/audio is definitely not trivial.

dear maschoen ,
thanks your answer
i have saw in the web page www.qnx.com ,that has the open source for
dvd player is Callback handler example
and A plaympegaudio_noph.c Example
can i use it to program application for DVD player?
regards,
tuyn

You cannot play DVD (Mpeg2) on QNX6.3 without purchasing a Multimedia TDK.

hello ,
i have code for callback DVD player ,
but i don’t know where is mplayer structure in this OS?
i try fine to find but can’t …or i have to write the method for mplayer?
please help me
thanks

static void dvdcallback( 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;
}

// take mutex for shared structures
pthread_mutex_lock(&player.mutex);

/* 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 );
}

// take mutex for shared structures
pthread_mutex_unlock(&player.mutex);

}

Hi everyone,
I have got a same problem, I work on QNX 6.2.1, and I have finished the MP3 player and Audio CD player with using Plugin (mpegaudio.so for MP3 player) and I think the DVD player must be like that. But, I still do not know what is the DLL file of DVD player Plugin, please help me know where I can find it.
Thank you very much.

By the way, I need to ask one more question. I have read on the QNX site and know that there’s a utility named [color=red]dvdplayer, but I can not also find it on my QNX machine (QNX 6.2.1). Could you tell me where I can find it?

hi everyone,
how do i program dll for DVD player?
please give me where to read and program dll for dvdplayer if you know
thanks ever so much,
Tuyn