summaryrefslogtreecommitdiffstats
path: root/libmpdemux
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
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')
-rw-r--r--libmpdemux/demuxer.c21
-rw-r--r--libmpdemux/demuxer.h1
-rw-r--r--libmpdemux/stheader.h2
3 files changed, 24 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;
diff --git a/libmpdemux/demuxer.h b/libmpdemux/demuxer.h
index 939a3b5577..35c3ac3982 100644
--- a/libmpdemux/demuxer.h
+++ b/libmpdemux/demuxer.h
@@ -284,6 +284,7 @@ inline static int demux_getc(demux_stream_t *ds){
void ds_free_packs(demux_stream_t *ds);
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 ds_get_packet_sub(demux_stream_t *ds,unsigned char **start);
float ds_get_next_pts(demux_stream_t *ds);
diff --git a/libmpdemux/stheader.h b/libmpdemux/stheader.h
index 3fcfebac7c..bc6a63cd45 100644
--- a/libmpdemux/stheader.h
+++ b/libmpdemux/stheader.h
@@ -47,6 +47,8 @@ typedef struct {
void* context; // codec-specific stuff (usually HANDLE or struct pointer)
unsigned char* codecdata; // extra header data passed from demuxer to codec
int codecdata_len;
+ double pts; // last known pts value in output from decoder
+ int pts_bytes; // bytes output by decoder after last known pts
} sh_audio_t;
typedef struct {