diff options
author | Lukasz Marek <lukasz.m.luki@gmail.com> | 2013-10-18 23:41:20 +0200 |
---|---|---|
committer | Stefano Sabatini <stefasab@gmail.com> | 2013-10-20 19:15:30 +0200 |
commit | d1f383341fda03b821496352f8e48a4ca4b7ee9a (patch) | |
tree | 1468214524444dc3f9beb768a4adb1718e83ac0d /libavdevice | |
parent | 2d8ccf0adcae09cb9e14b01cfe20e4d77c3bbf5d (diff) | |
download | ffmpeg-d1f383341fda03b821496352f8e48a4ca4b7ee9a.tar.gz |
lavd/pulse_audio_enc: add support for flushing
Signed-off-by: Lukasz Marek <lukasz.m.luki@gmail.com>
Signed-off-by: Stefano Sabatini <stefasab@gmail.com>
Diffstat (limited to 'libavdevice')
-rw-r--r-- | libavdevice/pulse_audio_enc.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/libavdevice/pulse_audio_enc.c b/libavdevice/pulse_audio_enc.c index 0a3aa1ad09..53436969f0 100644 --- a/libavdevice/pulse_audio_enc.c +++ b/libavdevice/pulse_audio_enc.c @@ -98,14 +98,20 @@ static av_cold int pulse_write_trailer(AVFormatContext *h) static int pulse_write_packet(AVFormatContext *h, AVPacket *pkt) { PulseData *s = h->priv_data; - int size = pkt->size; - uint8_t *buf = pkt->data; int error; + if (!pkt) { + if (pa_simple_flush(s->pa, &error) < 0) { + av_log(s, AV_LOG_ERROR, "pa_simple_flush failed: %s\n", pa_strerror(error)); + return AVERROR(EIO); + } + return 0; + } + if (s->stream_index != pkt->stream_index) return 0; - if (pa_simple_write(s->pa, buf, size, &error) < 0) { + if (pa_simple_write(s->pa, pkt->data, pkt->size, &error) < 0) { av_log(s, AV_LOG_ERROR, "pa_simple_write failed: %s\n", pa_strerror(error)); return AVERROR(EIO); } @@ -149,6 +155,6 @@ AVOutputFormat ff_pulse_muxer = { .write_packet = pulse_write_packet, .write_trailer = pulse_write_trailer, .get_output_timestamp = pulse_get_output_timestamp, - .flags = AVFMT_NOFILE, + .flags = AVFMT_NOFILE | AVFMT_ALLOW_FLUSH, .priv_class = &pulse_muxer_class, }; |