summaryrefslogtreecommitdiffstats
path: root/libao2
diff options
context:
space:
mode:
authorUoti Urpala <uau@mplayer2.org>2011-07-31 16:31:07 +0300
committerUoti Urpala <uau@mplayer2.org>2011-07-31 16:31:07 +0300
commit9d25699c5831c5188968c8ed69d32a5d534b8ff6 (patch)
tree42a154e2939755af7fa30e4ac9a94be90ef99280 /libao2
parentce9ce9d0c3a7e4e15d816a824f7312ad4c3c7cfc (diff)
downloadmpv-9d25699c5831c5188968c8ed69d32a5d534b8ff6.tar.bz2
mpv-9d25699c5831c5188968c8ed69d32a5d534b8ff6.tar.xz
audio: export audio pts to AO drivers
Currently the pts value is not directly used by any AO. Will be used by encoding code.
Diffstat (limited to 'libao2')
-rw-r--r--libao2/ao_ivtv.c6
-rw-r--r--libao2/ao_mpegpes.c8
-rw-r--r--libao2/ao_v4l2.c6
-rw-r--r--libao2/audio_out.h3
4 files changed, 12 insertions, 11 deletions
diff --git a/libao2/ao_ivtv.c b/libao2/ao_ivtv.c
index 540bc2f38a..e05537cbd8 100644
--- a/libao2/ao_ivtv.c
+++ b/libao2/ao_ivtv.c
@@ -78,7 +78,7 @@ init (int rate, int channels, int format, int flags)
ao_data.format = AF_FORMAT_MPEG2;
ao_data.buffersize = 2048;
ao_data.bps = rate * 2 * 2;
- ao_data.pts = 0;
+ ao_data.brokenpts = 0;
freq = rate;
/* check for supported audio rate */
@@ -127,7 +127,7 @@ get_space (void)
float x;
int y;
- x = (float) (vo_pts - ao_data.pts) / 90000.0;
+ x = (float) (vo_pts - ao_data.brokenpts) / 90000.0;
if (x <= 0)
return 0;
@@ -148,7 +148,7 @@ play (void *data, int len, int flags)
if (ao_data.format != AF_FORMAT_MPEG2)
return 0;
- send_mpeg_pes_packet (data, len, MPEG_AUDIO_ID, ao_data.pts, 2, ivtv_write);
+ send_mpeg_pes_packet (data, len, MPEG_AUDIO_ID, ao_data.brokenpts, 2, ivtv_write);
return len;
}
diff --git a/libao2/ao_mpegpes.c b/libao2/ao_mpegpes.c
index 0ede363864..fe3f20fc85 100644
--- a/libao2/ao_mpegpes.c
+++ b/libao2/ao_mpegpes.c
@@ -302,11 +302,11 @@ extern int vo_pts;
// return: how many bytes can be played without blocking
static int get_space(void){
- float x=(float)(vo_pts-ao_data.pts)/90000.0;
+ float x=(float)(vo_pts-ao_data.brokenpts)/90000.0;
int y;
//FIXME: is it correct?
if(vo_mpegpes_fd < 0) return 32000; //not using -vo mpegpes
-// printf("vo_pts: %5.3f ao_pts: %5.3f\n",vo_pts/90000.0,ao_data.pts/90000.0);
+// printf("vo_pts: %5.3f ao_pts: %5.3f\n",vo_pts/90000.0,ao_data.brokenpts/90000.0);
if(x<=0) return 0;
y=freq*4*x;y/=ao_data.outburst;y*=ao_data.outburst;
if(y>32000) y=32000;
@@ -320,11 +320,11 @@ static int get_space(void){
static int play(void* data,int len,int flags){
// printf("\nao_mpegpes: play(%d) freq=%d\n",len,freq_id);
if(ao_data.format==AF_FORMAT_MPEG2)
- send_mpeg_pes_packet (data, len, 0x1C0, ao_data.pts, 1, my_ao_write);
+ send_mpeg_pes_packet (data, len, 0x1C0, ao_data.brokenpts, 1, my_ao_write);
else {
// if(len>2000) len=2000;
// printf("ao_mpegpes: len=%d \n",len);
- send_mpeg_lpcm_packet(data, len, 0xA0, ao_data.pts, freq_id, my_ao_write);
+ send_mpeg_lpcm_packet(data, len, 0xA0, ao_data.brokenpts, freq_id, my_ao_write);
}
return len;
}
diff --git a/libao2/ao_v4l2.c b/libao2/ao_v4l2.c
index 2eac1031e5..2bc74379a0 100644
--- a/libao2/ao_v4l2.c
+++ b/libao2/ao_v4l2.c
@@ -75,7 +75,7 @@ init (int rate, int channels, int format, int flags)
ao_data.format = AF_FORMAT_MPEG2;
ao_data.buffersize = 2048;
ao_data.bps = rate * 2 * 2;
- ao_data.pts = 0;
+ ao_data.brokenpts = 0;
freq = rate;
/* check for supported audio rate */
@@ -124,7 +124,7 @@ get_space (void)
float x;
int y;
- x = (float) (vo_pts - ao_data.pts) / 90000.0;
+ x = (float) (vo_pts - ao_data.brokenpts) / 90000.0;
if (x <= 0)
return 0;
@@ -145,7 +145,7 @@ play (void *data, int len, int flags)
if (ao_data.format != AF_FORMAT_MPEG2)
return 0;
- send_mpeg_pes_packet (data, len, MPEG_AUDIO_ID, ao_data.pts, 2, v4l2_write);
+ send_mpeg_pes_packet (data, len, MPEG_AUDIO_ID, ao_data.brokenpts, 2, v4l2_write);
return len;
}
diff --git a/libao2/audio_out.h b/libao2/audio_out.h
index 628b9c3ae7..e96e123700 100644
--- a/libao2/audio_out.h
+++ b/libao2/audio_out.h
@@ -72,7 +72,8 @@ struct ao {
int bps;
int outburst;
int buffersize;
- int pts;
+ int brokenpts;
+ double pts;
struct bstr buffer;
int buffer_playable_size;
bool initialized;