Commit e46a2a73 authored by Justin Ruggles's avatar Justin Ruggles

flvdec: read audio sample size and channels metadata

This is needed in order for the FLV demuxer not to detect a codec change when
using the "flv_metadata" option.
parent c3d01577
...@@ -400,7 +400,7 @@ static int amf_parse_object(AVFormatContext *s, AVStream *astream, AVStream *vst ...@@ -400,7 +400,7 @@ static int amf_parse_object(AVFormatContext *s, AVStream *astream, AVStream *vst
acodec = astream ? astream->codec : NULL; acodec = astream ? astream->codec : NULL;
vcodec = vstream ? vstream->codec : NULL; vcodec = vstream ? vstream->codec : NULL;
if (amf_type == AMF_DATA_TYPE_NUMBER) { if (amf_type == AMF_DATA_TYPE_NUMBER || amf_type == AMF_DATA_TYPE_BOOL) {
if (!strcmp(key, "duration")) if (!strcmp(key, "duration"))
s->duration = num_val * AV_TIME_BASE; s->duration = num_val * AV_TIME_BASE;
else if (!strcmp(key, "videodatarate") && vcodec && 0 <= (int)(num_val * 1024.0)) else if (!strcmp(key, "videodatarate") && vcodec && 0 <= (int)(num_val * 1024.0))
...@@ -422,6 +422,13 @@ static int amf_parse_object(AVFormatContext *s, AVStream *astream, AVStream *vst ...@@ -422,6 +422,13 @@ static int amf_parse_object(AVFormatContext *s, AVStream *astream, AVStream *vst
} else } else
if (!strcmp(key, "audiosamplerate") && acodec) { if (!strcmp(key, "audiosamplerate") && acodec) {
acodec->sample_rate = num_val; acodec->sample_rate = num_val;
} else if (!strcmp(key, "audiosamplesize") && acodec) {
acodec->bits_per_coded_sample = num_val;
} else if (!strcmp(key, "stereo") && acodec) {
acodec->channels = num_val + 1;
acodec->channel_layout = acodec->channels == 2 ?
AV_CH_LAYOUT_STEREO :
AV_CH_LAYOUT_MONO;
} else } else
if (!strcmp(key, "width") && vcodec) { if (!strcmp(key, "width") && vcodec) {
vcodec->width = num_val; vcodec->width = num_val;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment