[FFmpeg-devel] [PATCH 2/2] lavd/pulse_audio_enc: implement write_uncoded_frame callback

Lukasz Marek lukasz.m.luki2 at gmail.com
Mon Mar 24 17:58:24 CET 2014


Signed-off-by: Lukasz Marek <lukasz.m.luki2 at gmail.com>
---
 libavdevice/pulse_audio_enc.c |   17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/libavdevice/pulse_audio_enc.c b/libavdevice/pulse_audio_enc.c
index 4fb64ed..d83fff8 100644
--- a/libavdevice/pulse_audio_enc.c
+++ b/libavdevice/pulse_audio_enc.c
@@ -141,6 +141,22 @@ 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;
+
+    if (flags & AV_WRITE_UNCODED_FRAME_QUERY)
+        return  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 +194,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,
-- 
1.7.10.4



More information about the ffmpeg-devel mailing list