diff options
author | Igor Derzhavin <igor.derzhavin@gmail.com> | 2018-11-22 10:54:42 +0300 |
---|---|---|
committer | Carl Eugen Hoyos <ceffmpeg@gmail.com> | 2018-11-25 00:25:03 +0100 |
commit | f95c928f80f19535e43671e6cf568a192b73afde (patch) | |
tree | 08992308e04d1a60ca8090162564ceaf22d26176 | |
parent | b058617fae201f204f7b36bde3fb95795d52c279 (diff) | |
download | ffmpeg-f95c928f80f19535e43671e6cf568a192b73afde.tar.gz |
avformat/pcmdec: endianness for audio/L16 mime type
-rw-r--r-- | libavformat/pcmdec.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/libavformat/pcmdec.c b/libavformat/pcmdec.c index 8530dbc1e3..9895af03a4 100644 --- a/libavformat/pcmdec.c +++ b/libavformat/pcmdec.c @@ -50,9 +50,9 @@ static int pcm_read_header(AVFormatContext *s) av_opt_get(s->pb, "mime_type", AV_OPT_SEARCH_CHILDREN, &mime_type); if (mime_type && s->iformat->mime_type) { - int rate = 0, channels = 0; + int rate = 0, channels = 0, little_endian = 0; size_t len = strlen(s->iformat->mime_type); - if (!av_strncasecmp(s->iformat->mime_type, mime_type, len)) { + if (!av_strncasecmp(s->iformat->mime_type, mime_type, len)) { /* audio/L16 */ uint8_t *options = mime_type + len; len = strlen(mime_type); while (options < mime_type + len) { @@ -63,6 +63,12 @@ static int pcm_read_header(AVFormatContext *s) sscanf(options, " rate=%d", &rate); if (!channels) sscanf(options, " channels=%d", &channels); + if (!little_endian) { + char val[14]; /* sizeof("little-endian") == 14 */ + if (sscanf(options, " endianness=%13s", val) == 1) { + little_endian = strcmp(val, "little-endian") == 0; + } + } } if (rate <= 0) { av_log(s, AV_LOG_ERROR, @@ -74,6 +80,8 @@ static int pcm_read_header(AVFormatContext *s) st->codecpar->sample_rate = rate; if (channels > 0) st->codecpar->channels = channels; + if (little_endian) + st->codecpar->codec_id = AV_CODEC_ID_PCM_S16LE; } } av_freep(&mime_type); |