aboutsummaryrefslogtreecommitdiffstats
path: root/libavdevice/pulse.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-08-30 21:07:32 +0200
committerMichael Niedermayer <michaelni@gmx.at>2014-08-30 21:07:56 +0200
commitd03fd2c8052ee80e7221ab02ab0fcb5220e92698 (patch)
tree443758956fe57368f9372afd061d8809fafd8a37 /libavdevice/pulse.c
parent946a106995bca70a360f5bd03fa503e8beb09cc5 (diff)
parent124ec8b1303d4f29b833099ce9008e31ac6d7c86 (diff)
downloadffmpeg-d03fd2c8052ee80e7221ab02ab0fcb5220e92698.tar.gz
Merge commit '124ec8b1303d4f29b833099ce9008e31ac6d7c86' into release/1.1
* commit '124ec8b1303d4f29b833099ce9008e31ac6d7c86': pulse: Add a wallclock option to be compatible with other other captures Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavdevice/pulse.c')
-rw-r--r--libavdevice/pulse.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/libavdevice/pulse.c b/libavdevice/pulse.c
index 86fdc22837..904aeffe70 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 },
};