[FFmpeg-cvslog] pulse: Add a wallclock option to be compatible with other other captures
Luca Barbato
git at videolan.org
Sun Sep 14 15:58:39 CEST 2014
ffmpeg | branch: release/2.4 | Luca Barbato <lu_zero at gentoo.org> | Sat Aug 23 19:03:21 2014 +0200| [e62f08ca8d6e558956ff3094085338cb4dd6afd8] | committer: Luca Barbato
pulse: Add a wallclock option to be compatible with other other captures
alsa and x11grab use av_gettime() to report timestamps.
Have it on by default.
Bug-Id: 647
(cherry picked from commit 424b929b5cb9ca4094099f25179829260d4b0fa3)
(cherry picked from commit 404731bd20e1df5880e6fe381e975ba48afc75b2)
Signed-off-by: Luca Barbato <lu_zero at gentoo.org>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e62f08ca8d6e558956ff3094085338cb4dd6afd8
---
libavdevice/pulse.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/libavdevice/pulse.c b/libavdevice/pulse.c
index a8e710d..2136ee3 100644
--- a/libavdevice/pulse.c
+++ b/libavdevice/pulse.c
@@ -31,6 +31,7 @@
#include "libavformat/avformat.h"
#include "libavformat/internal.h"
+#include "libavutil/time.h"
#include "libavutil/opt.h"
#define DEFAULT_CODEC_ID AV_NE(AV_CODEC_ID_PCM_S16BE, AV_CODEC_ID_PCM_S16LE)
@@ -47,6 +48,7 @@ typedef struct PulseData {
pa_simple *s;
int64_t pts;
int64_t frame_duration;
+ int wallclock;
} PulseData;
static pa_sample_format_t codec_id_to_pulse_format(int codec_id) {
@@ -141,6 +143,8 @@ static int pulse_read_packet(AVFormatContext *s, AVPacket *pkt)
if (pd->pts == AV_NOPTS_VALUE) {
pd->pts = -latency;
+ if (pd->wallclock)
+ pd->pts += av_gettime();
}
pkt->pts = pd->pts;
@@ -168,6 +172,7 @@ static const AVOption options[] = {
{ "channels", "number of audio channels", OFFSET(channels), AV_OPT_TYPE_INT, {.i64 = 2}, 1, INT_MAX, D },
{ "frame_size", "number of bytes per frame", OFFSET(frame_size), AV_OPT_TYPE_INT, {.i64 = 1024}, 1, INT_MAX, D },
{ "fragment_size", "buffering size, affects latency and cpu usage", OFFSET(fragment_size), AV_OPT_TYPE_INT, {.i64 = -1}, -1, INT_MAX, D },
+ { "wallclock", "set the initial pts using the current time", OFFSET(wallclock), AV_OPT_TYPE_INT, {.i64 = 1}, -1, 1, D },
{ NULL },
};
More information about the ffmpeg-cvslog
mailing list