Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas George <nicolas.george@normalesup.org>2012-02-16 18:00:18 +0400
committerNicolas George <nicolas.george@normalesup.org>2012-02-22 14:37:32 +0400
commit534a82a3fd3f2d82af62ae610e29284d1ca98b11 (patch)
tree155438face0189f043d3f80b8bf7861fa7a2b20f /libavdevice/lavfi.c
parent9cbf17e9af80cb450042ebaf5e28692044b574cf (diff)
lavd/lavfi: support all sample formats.
Diffstat (limited to 'libavdevice/lavfi.c')
-rw-r--r--libavdevice/lavfi.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/libavdevice/lavfi.c b/libavdevice/lavfi.c
index 30c08e0d95..0a6eb913dd 100644
--- a/libavdevice/lavfi.c
+++ b/libavdevice/lavfi.c
@@ -206,7 +206,11 @@ av_cold static int lavfi_read_header(AVFormatContext *avctx)
if (ret < 0)
goto end;
} else if (type == AVMEDIA_TYPE_AUDIO) {
- enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_S16, -1 };
+ enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_U8,
+ AV_SAMPLE_FMT_S16,
+ AV_SAMPLE_FMT_S32,
+ AV_SAMPLE_FMT_FLT,
+ AV_SAMPLE_FMT_DBL, -1 };
const int packing_fmts[] = { AVFILTER_PACKED, -1 };
const int64_t *chlayouts = avfilter_all_channel_layouts;
AVABufferSinkParams *abuffersink_params = av_abuffersink_params_alloc();
@@ -253,12 +257,16 @@ av_cold static int lavfi_read_header(AVFormatContext *avctx)
st ->sample_aspect_ratio =
st->codec->sample_aspect_ratio = link->sample_aspect_ratio;
} else if (link->type == AVMEDIA_TYPE_AUDIO) {
- st->codec->codec_id = CODEC_ID_PCM_S16LE;
+ st->codec->codec_id = av_get_pcm_codec(link->format, -1);
st->codec->channels = av_get_channel_layout_nb_channels(link->channel_layout);
st->codec->sample_fmt = link->format;
st->codec->sample_rate = link->sample_rate;
st->codec->time_base = link->time_base;
st->codec->channel_layout = link->channel_layout;
+ if (st->codec->codec_id == CODEC_ID_NONE)
+ av_log(avctx, AV_LOG_ERROR,
+ "Could not find PCM codec for sample format %s.\n",
+ av_get_sample_fmt_name(link->format));
}
}