Mercurial > mplayer.hg
diff libmpdemux/demuxer.c @ 18242:caac2ca98168
4 - Implement a better way to calculate current audio pts and use it for
audio decoded with ad_libvorbis, ad_ffmpeg and ad_faad.
Patch by Uoti Urpala
author | rtognimp |
---|---|
date | Mon, 24 Apr 2006 10:58:40 +0000 |
parents | 4231482179b6 |
children | 87161f96fa66 |
line wrap: on
line diff
--- a/libmpdemux/demuxer.c Mon Apr 24 10:36:29 2006 +0000 +++ b/libmpdemux/demuxer.c Mon Apr 24 10:58:40 2006 +0000 @@ -224,6 +224,7 @@ sh->samplesize=2; sh->sample_format=AF_FORMAT_S16_NE; sh->audio_out_minsize=8192;/* default size, maybe not enough for Win32/ACM*/ + sh->pts=MP_NOPTS_VALUE; if (!demux_aid_vid_mismatch) mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_AUDIO_ID=%d\n", id); } @@ -502,6 +503,26 @@ } } +int ds_get_packet_pts(demux_stream_t *ds,unsigned char **start, double *pts) +{ + int len; + *pts = MP_NOPTS_VALUE; + if(ds->buffer_pos>=ds->buffer_size){ + if (!ds_fill_buffer(ds)) { + // EOF + *start = NULL; + return -1; + } + // Should use MP_NOPTS_VALUE for "unknown pts" in the packets too + if (ds->current->pts) + *pts = ds->current->pts; + } + len=ds->buffer_size-ds->buffer_pos; + *start = &ds->buffer[ds->buffer_pos]; + ds->buffer_pos+=len; + return len; +} + int ds_get_packet_sub(demux_stream_t *ds,unsigned char **start){ while(1){ int len;