[PATCH 2/2] Parse MDPR configuration for audio/x-ralf-mpeg4.
Jai Menon
jai
Thu Dec 24 15:49:07 CET 2009
---
libavformat/rmdec.c | 30 ++++++++++++++++++++++++++++++
1 files changed, 30 insertions(+), 0 deletions(-)
diff --git a/libavformat/rmdec.c b/libavformat/rmdec.c
index 1da024a..c6f7f7b 100644
--- a/libavformat/rmdec.c
+++ b/libavformat/rmdec.c
@@ -300,6 +300,36 @@ ff_rm_read_mdpr_codecdata (AVFormatContext *s, ByteIOContext *pb,
/* ra type header */
if (rm_read_audio_stream_info(s, pb, st, rst, 0))
return -1;
+ } else if (v == AV_RB32("LSD:")) {
+ if (codec_data_size < 24) {
+ av_log(s, AV_LOG_ERROR, "Config data size too small.\n");
+ return -1;
+ }
+ st->codec->codec_type = CODEC_TYPE_AUDIO;
+ st->codec->codec_id = CODEC_ID_RALF;
+ if (get_be16(pb) == 259) {
+ get_be16(pb); // unused
+ st->codec->channels = get_be16(pb);
+ if (!st->codec->channels || st->codec->channels > 2) {
+ av_log(s, AV_LOG_ERROR, "Only mono and stereo RALF streams are supported.\n");
+ return -1;
+ }
+ st->codec->bits_per_coded_sample = get_be16(pb);
+ if (st->codec->bits_per_coded_sample != 16) {
+ av_log(s, AV_LOG_ERROR, "Invalid sample depth.\n");
+ return -1;
+ }
+ st->codec->sample_rate = get_be32(pb);
+ if (st->codec->sample_rate < 8000 || st->codec->sample_rate > 96000) {
+ av_log(s, AV_LOG_ERROR, "Invalid sampling rate.\n");
+ return -1;
+ }
+ get_be32(pb); // Max. audio frame size (in bytes)
+ get_be32(pb); // unused
+ } else {
+ av_log(s, AV_LOG_ERROR, "Incorrect RALF config data.\n");
+ return -1;
+ }
} else {
int fps, fps2;
if (get_le32(pb) != MKTAG('V', 'I', 'D', 'O')) {
--
1.6.5.2
--Bn2rw/3z4jIqBvZU--
More information about the ffmpeg-devel
mailing list