Mercurial > mplayer.hg
changeset 21781:36112fcf78d6
replace call to ds_read_packet() with the usual stream_read()+ds_add_packet() sequence;
fill demux_packet->stream_pts if the stream layer supports it
author | nicodvb |
---|---|
date | Sun, 31 Dec 2006 11:08:27 +0000 |
parents | c9795699c414 |
children | 99ab6c41eb1e |
files | libmpdemux/demux_mpg.c |
diffstat | 1 files changed, 19 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/libmpdemux/demux_mpg.c Sun Dec 31 11:05:26 2006 +0000 +++ b/libmpdemux/demux_mpg.c Sun Dec 31 11:08:27 2006 +0000 @@ -191,7 +191,10 @@ unsigned char c=0; unsigned long long pts=0; unsigned long long dts=0; + int l; + double stream_pts = MP_NOPTS_VALUE; demux_stream_t *ds=NULL; + demux_packet_t* dp; mpg_demuxer_t *priv = (mpg_demuxer_t *) demux->priv; mp_dbg(MSGT_DEMUX,MSGL_DBG3,"demux_read_packet: %X\n",id); @@ -405,7 +408,22 @@ if(ds){ mp_dbg(MSGT_DEMUX,MSGL_DBG2,"DEMUX_MPG: Read %d data bytes from packet %04X\n",len,id); // printf("packet start = 0x%X \n",stream_tell(demux->stream)-packet_start_pos); - ds_read_packet(ds,demux->stream,len,pts/90000.0f,demux->filepos,0); + + dp=new_demux_packet(len); + if(!dp) { + mp_dbg(MSGT_DEMUX,MSGL_ERR,"DEMUX_MPG ERROR: couldn't create demux_packet(%d bytes)\n",len); + stream_skip(demux->stream,len); + return 0; + } + l = stream_read(demux->stream,dp->buffer,len); + if(l<len) + resize_demux_packet(dp, l); + len = l; + dp->pts=pts/90000.0f; + dp->pos=demux->filepos; + if(stream_control(demux->stream, STREAM_CTRL_GET_CURRENT_TIME,(void *)&stream_pts)!=STREAM_UNSUPORTED) + dp->stream_pts = stream_pts; + ds_add_packet(ds,dp); if (demux->priv) ((mpg_demuxer_t*)demux->priv)->last_pts = pts/90000.0f; // if(ds==demux->sub) parse_dvdsub(ds->last->buffer,ds->last->len); return 1;