[MPlayer-dev-eng] [PATCH] dvdnav - wait, still frame, change audio and spu (nav)

Nico Sabbi nicola_sabbi at fastwebnet.it
Sat Mar 10 21:15:46 CET 2007


Ötvös Attila wrote:
> 2007. március 9. 00.53 dátummal Nico Sabbi ezt írta:
> 
>>please, describe in detail what every patch is supposed to do and
>>comment the code. How can we review such huge changes without comments'
> 
> Hi Nico Sabbi!
> 
> My main modifies are in dvdnav.patch:
> 
> 1, Wait, still frame in stream_dvdnav.c
> 
> If wait or still frame is then the fill_buffer() in stream_dvdnav.c returnes 
> with -1 readed bytes. 
> At other streams are an eof but there it is needed to call 
> mp_dvdnav_isreallyeof() so that stream is really eof.
> If the video pts is greater than cell the duration clear wait or still frame 
> event will be cleared.
> If the duartion isn't setted (still_length=255) then will be only cleared id 
> the activate of menu button will be.
> The wait event is such as the still frame bacause of wait_read flag, but it 
> needn't use in open demuxer (wait_read_automode=0).
> 
> 2, Wait, still frame is mplayer.c
> 
> If wait or still frame is then mplayer decodes last read video frame.
> Mplayer store the decodes frame and after it this uses such as decoded_frame.
> At the first the decoding is usually unsuccessful so it have to probe several 
> times (x5).
> The mp_dvdnav_decode_video_pre() and mp_dvdnav_decode_video_post() do this.
> 
> 3, Audio channels, subtitles and SPU menu buttons in mplayer.c
> 
> The mp_dvdnav_audio_handle() does the audio channel is use change.
> The mp_dvdnav_spu_handle() does the subtitle channel is use change.
> The mp_dvdnav_highlight_handle() does the SPU menu buttos is use change.
> 
> 4, The properties of the are audio channels in stream_dvdnav.c
> 
> Now, the audio attr in dvdnav can't be queried..
> The mp_dvdnav_set_audio_channels() tries to make it on the basis of dvdnav and 
> demuxer audio id.
> 
> I append comments to dvdnav.patch.
> 
> Best regards!
> Attila
> 

this patch should have been split in at least 20 individual pieces, 
but for this time around I'll comment on a part that looked good
but that can't be applied due to limitations and bugs of dvdnav:


>  
> +//
> +// convert dvd time to millisec
> +//
> +static int dvdtimetomsec(dvd_time_t *dt)
you should have exported the function from steram_dvd.c instead

> +
>  static int dvdnav_stream_read(dvdnav_priv_t * priv, unsigned char *buf, int *len) {
>    int event = DVDNAV_NOP;
>  
> @@ -174,9 +198,25 @@
>          break;
>        }
>        case DVDNAV_CELL_CHANGE: {
> +	priv->wait_skip=0;
> +	priv->audio_change = 1;
> +	priv->spu_change = 1;
> +	priv->stream_change = 1;
>          dvdnav_cell_change_event_t *ev =  (dvdnav_cell_change_event_t*)buf;
>          if(ev->pgc_length)
> -          priv->duration = ev->pgc_length/90;
> +          priv->duration = ev->pgc_length/90;			// set cell duration
> +	priv->start_pts = ev->cell_start/90;			// set cell start time

yes, but unfortunately dvdnav doesn't discard cell times relative to
other angles than the ones we are playing. It's easy to fix,
but there's no one to apply patches ;(

(BTW, I hope my mates now understand what I wanted to fork libdvdnav)



>      }
> +    case STREAM_CTRL_GET_CURRENT_TIME:
> +    {
> +	double tm = MP_NOPTS_VALUE;
> +	if (!priv->vts_domain) {	// if no vts domain then
> +	    tm += 1.0f;			// stream_pts = MP_NOPTS_VALUE
> +	    *((double *)arg) = tm;
> +	    return 1;
> +	    }
> +	dsi_t* pnavdsi = NULL;
> +	if (!(pnavdsi = dvdnav_get_current_nav_dsi (priv->dvdnav)))
> +	    return STREAM_UNSUPORTED;
> +	dvd_time_t *c_eltm;
> +	c_eltm = &(pnavdsi->dsi_gi.c_eltm);
> +	tm = priv->start_pts;		// cell start pts
> +	tm += dvdtimetomsec( c_eltm );	// + current pts in cell
> +	tm = tm / 1000.0f;
> +        if(tm != -1) {
> +          *((double *)arg) = tm;
> +          return 1;
> +        }
> +        break;
> +    }
>    }

good, but unfortunately after seeking priv->start_pts will contain
a wrong value until you find the next cell!

As usual I had to skip dozens of unrelated patches...

-- 
"Without a frontend, mplayer is useless" - someone on mplayer-dev-eng




More information about the MPlayer-dev-eng mailing list