[FFmpeg-devel] [PATCH 1/3] lavd/pulse_audio_enc: implementation of query_codec

Lukasz Marek lukasz.m.luki at gmail.com
Fri Nov 1 15:40:48 CET 2013


Implementation of query_codec callback that allow to
check if specific codec is supported by device.

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

diff --git a/libavdevice/pulse_audio_enc.c b/libavdevice/pulse_audio_enc.c
index 591e518..e8eae33 100644
--- a/libavdevice/pulse_audio_enc.c
+++ b/libavdevice/pulse_audio_enc.c
@@ -134,6 +134,21 @@ static void pulse_get_output_timestamp(AVFormatContext *h, int stream, int64_t *
     *dts = s->timestamp - latency;
 }
 
+static int pulse_query_codec(enum AVCodecID id, int std_compliance)
+{
+    return id == AV_CODEC_ID_PCM_U8    ||
+           id == AV_CODEC_ID_PCM_ALAW  ||
+           id == AV_CODEC_ID_PCM_MULAW ||
+           id == AV_CODEC_ID_PCM_S16LE ||
+           id == AV_CODEC_ID_PCM_S16BE ||
+           id == AV_CODEC_ID_PCM_F32LE ||
+           id == AV_CODEC_ID_PCM_F32BE ||
+           id == AV_CODEC_ID_PCM_S32LE ||
+           id == AV_CODEC_ID_PCM_S32BE ||
+           id == AV_CODEC_ID_PCM_S24LE ||
+           id == AV_CODEC_ID_PCM_S24BE ? 1 : 0;
+}
+
 #define OFFSET(a) offsetof(PulseData, a)
 #define E AV_OPT_FLAG_ENCODING_PARAM
 
@@ -162,6 +177,7 @@ AVOutputFormat ff_pulse_muxer = {
     .write_packet   = pulse_write_packet,
     .write_trailer  = pulse_write_trailer,
     .get_output_timestamp = pulse_get_output_timestamp,
+    .query_codec    = pulse_query_codec,
     .flags          = AVFMT_NOFILE | AVFMT_ALLOW_FLUSH,
     .priv_class     = &pulse_muxer_class,
 };
-- 
1.7.10.4



More information about the ffmpeg-devel mailing list