[FFmpeg-cvslog] ALSA: implement get_output_timestamp.

Nicolas George git at videolan.org
Fri Jul 1 10:06:07 CEST 2011


ffmpeg | branch: master | Nicolas George <nicolas.george at normalesup.org> | Thu Jun 30 19:46:02 2011 +0200| [84c2d8af135695e829fb5ce5e8569d02678550a8] | committer: Nicolas George

ALSA: implement get_output_timestamp.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=84c2d8af135695e829fb5ce5e8569d02678550a8
---

 libavdevice/alsa-audio-enc.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/libavdevice/alsa-audio-enc.c b/libavdevice/alsa-audio-enc.c
index 22a1ea7..0da22bb 100644
--- a/libavdevice/alsa-audio-enc.c
+++ b/libavdevice/alsa-audio-enc.c
@@ -102,6 +102,17 @@ static int audio_write_packet(AVFormatContext *s1, AVPacket *pkt)
     return 0;
 }
 
+static void
+audio_get_output_timestamp(AVFormatContext *s1, int stream,
+    int64_t *dts, int64_t *wall)
+{
+    AlsaData *s  = s1->priv_data;
+    snd_pcm_sframes_t delay = 0;
+    *wall = av_gettime();
+    snd_pcm_delay(s->h, &delay);
+    *dts = s1->streams[0]->cur_dts - delay;
+}
+
 AVOutputFormat ff_alsa_muxer = {
     "alsa",
     NULL_IF_CONFIG_SMALL("ALSA audio output"),
@@ -113,5 +124,6 @@ AVOutputFormat ff_alsa_muxer = {
     audio_write_header,
     audio_write_packet,
     ff_alsa_close,
+    .get_output_timestamp = audio_get_output_timestamp,
     .flags = AVFMT_NOFILE,
 };



More information about the ffmpeg-cvslog mailing list