Skip to content

Commit

Permalink
flvdec: read audio sample size and channels metadata
Browse files Browse the repository at this point in the history
This is needed in order for the FLV demuxer not to detect a codec change when
using the "flv_metadata" option.
  • Loading branch information
justinruggles committed Mar 28, 2013
1 parent c3d0157 commit e46a2a7
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion libavformat/flvdec.c
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ static int amf_parse_object(AVFormatContext *s, AVStream *astream, AVStream *vst
acodec = astream ? astream->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"))
s->duration = num_val * AV_TIME_BASE;
else if (!strcmp(key, "videodatarate") && vcodec && 0 <= (int)(num_val * 1024.0))
Expand All @@ -422,6 +422,13 @@ static int amf_parse_object(AVFormatContext *s, AVStream *astream, AVStream *vst
} else
if (!strcmp(key, "audiosamplerate") && acodec) {
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
if (!strcmp(key, "width") && vcodec) {
vcodec->width = num_val;
Expand Down

0 comments on commit e46a2a7

Please sign in to comment.