summaryrefslogtreecommitdiffstats
path: root/libmpdemux/demuxer.c
diff options
context:
space:
mode:
authorrtognimp <rtognimp@b3059339-0415-0410-9bf9-f77b7e298cf2>2006-04-24 10:58:40 +0000
committerrtognimp <rtognimp@b3059339-0415-0410-9bf9-f77b7e298cf2>2006-04-24 10:58:40 +0000
commit6c4d9bfe5127da2a4e2afbe1d6e585ebeb7c5949 (patch)
tree6057e1a4875492c40543d4ac2e43adbbd53afff2 /libmpdemux/demuxer.c
parent4b45ec30e4b8ced93aa10792aa18a8f96b3cd104 (diff)
downloadmpv-6c4d9bfe5127da2a4e2afbe1d6e585ebeb7c5949.tar.bz2
mpv-6c4d9bfe5127da2a4e2afbe1d6e585ebeb7c5949.tar.xz
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 git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@18243 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libmpdemux/demuxer.c')
-rw-r--r--libmpdemux/demuxer.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/libmpdemux/demuxer.c b/libmpdemux/demuxer.c
index f45d325d55..14709e9e82 100644
--- a/libmpdemux/demuxer.c
+++ b/libmpdemux/demuxer.c
@@ -224,6 +224,7 @@ sh_audio_t* new_sh_audio(demuxer_t *demuxer,int id){
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(demux_stream_t *ds,unsigned char **start){
}
}
+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;