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) {
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,
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);