diff options
author | Lukasz Marek <lukasz.m.luki@gmail.com> | 2014-03-24 17:55:07 +0100 |
---|---|---|
committer | Lukasz Marek <lukasz.m.luki@gmail.com> | 2014-03-29 09:26:10 +0100 |
commit | 27256e69ab2df625a431dfe67c6a7aa364992a48 (patch) | |
tree | a88f8b8ab808ab4fdfee436a44437afe3b905b02 /libavdevice/pulse_audio_enc.c | |
parent | fd786bad6321dd800265b1e5ae8c7e1d2e272a94 (diff) | |
download | ffmpeg-27256e69ab2df625a431dfe67c6a7aa364992a48.tar.gz |
lavd/pulse_audio_enc: implement write_uncoded_frame callback
Provided implementation doesn't support planar formats yet.
Signed-off-by: Lukasz Marek <lukasz.m.luki@gmail.com>
Diffstat (limited to 'libavdevice/pulse_audio_enc.c')
-rw-r--r-- | libavdevice/pulse_audio_enc.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/libavdevice/pulse_audio_enc.c b/libavdevice/pulse_audio_enc.c index 4fb64ed471..03f713cb15 100644 --- a/libavdevice/pulse_audio_enc.c +++ b/libavdevice/pulse_audio_enc.c @@ -141,6 +141,24 @@ static int pulse_write_packet(AVFormatContext *h, AVPacket *pkt) return 0; } +static int pulse_write_frame(AVFormatContext *h, int stream_index, + AVFrame **frame, unsigned flags) +{ + AVPacket pkt; + + /* Planar formats are not supported yet. */ + if (flags & AV_WRITE_UNCODED_FRAME_QUERY) + return av_sample_fmt_is_planar(h->streams[stream_index]->codec->sample_fmt) ? + AVERROR(EINVAL) : 0; + + pkt.data = (*frame)->data[0]; + pkt.size = (*frame)->nb_samples * av_get_bytes_per_sample((*frame)->format) * (*frame)->channels; + pkt.dts = (*frame)->pkt_dts; + pkt.duration = av_frame_get_pkt_duration(*frame); + return pulse_write_packet(h, &pkt); +} + + static void pulse_get_output_timestamp(AVFormatContext *h, int stream, int64_t *dts, int64_t *wall) { PulseData *s = h->priv_data; @@ -178,6 +196,7 @@ AVOutputFormat ff_pulse_muxer = { .video_codec = AV_CODEC_ID_NONE, .write_header = pulse_write_header, .write_packet = pulse_write_packet, + .write_uncoded_frame = pulse_write_frame, .write_trailer = pulse_write_trailer, .get_output_timestamp = pulse_get_output_timestamp, .flags = AVFMT_NOFILE | AVFMT_ALLOW_FLUSH, |