aboutsummaryrefslogtreecommitdiff
path: root/libavdevice
diff options
context:
space:
mode:
authorMichael Niedermayer2011-11-15 03:13:42 +0100
committerMichael Niedermayer2011-11-15 03:13:42 +0100
commita72580fc9efeb674257b4754ca5de0fa34b09be8 (patch)
tree317e10288d30721f1f20c6c5bb9d99945d4351bd /libavdevice
parentbe4c9a440f4e8b6ea01112d98a2cc128b8c52295 (diff)
parent3f5d6a665aba439a9309ed735e71403d236a313d (diff)
Merge remote-tracking branch 'qatar/master'
* qatar/master: binkvideo: simplify and remove invalid shifts pulse: compute frame_duration once and fix it lavf: simplify format_child_class_next() hwaccel: OS X Video Decoder Acceleration (VDA) support. doc: add support for an optional navigation bar in texi2html pages Conflicts: configure libavcodec/Makefile libavcodec/allcodecs.c libavcodec/vda.c libavcodec/vda.h libavcodec/vda_h264.c libavcodec/vda_internal.h libavcodec/version.h libavformat/options.c libavutil/avutil.h libavutil/pixfmt.h Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavdevice')
-rw-r--r--libavdevice/pulse.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/libavdevice/pulse.c b/libavdevice/pulse.c
index 79da7a6bfb..0b60651d08 100644
--- a/libavdevice/pulse.c
+++ b/libavdevice/pulse.c
@@ -46,6 +46,7 @@ typedef struct PulseData {
int fragment_size;
pa_simple *s;
int64_t pts;
+ int64_t frame_duration;
} PulseData;
static pa_sample_format_t codec_id_to_pulse_format(int codec_id) {
@@ -110,6 +111,8 @@ static av_cold int pulse_read_header(AVFormatContext *s,
av_set_pts_info(st, 64, 1, 1000000); /* 64 bits pts in us */
pd->pts = AV_NOPTS_VALUE;
+ pd->frame_duration = (pd->frame_size * 1000000LL * 8) /
+ (pd->sample_rate * pd->channels * av_get_bits_per_sample(codec_id));
return 0;
}
@@ -119,8 +122,6 @@ static int pulse_read_packet(AVFormatContext *s, AVPacket *pkt)
PulseData *pd = s->priv_data;
int res;
pa_usec_t latency;
- uint64_t frame_duration =
- (pd->frame_size*1000000LL) / (pd->sample_rate * pd->channels);
if (av_new_packet(pkt, pd->frame_size) < 0) {
return AVERROR(ENOMEM);
@@ -145,7 +146,7 @@ static int pulse_read_packet(AVFormatContext *s, AVPacket *pkt)
pkt->pts = pd->pts;
- pd->pts += frame_duration;
+ pd->pts += pd->frame_duration;
return 0;
}