|
|
@ -60,6 +60,7 @@ static int speex_header(AVFormatContext *s, int idx) { |
|
|
|
|
|
|
|
|
|
|
|
if (spxp->seq == 0) { |
|
|
|
if (spxp->seq == 0) { |
|
|
|
int frames_per_packet; |
|
|
|
int frames_per_packet; |
|
|
|
|
|
|
|
int channels; |
|
|
|
st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO; |
|
|
|
st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO; |
|
|
|
st->codecpar->codec_id = AV_CODEC_ID_SPEEX; |
|
|
|
st->codecpar->codec_id = AV_CODEC_ID_SPEEX; |
|
|
|
|
|
|
|
|
|
|
@ -73,13 +74,12 @@ static int speex_header(AVFormatContext *s, int idx) { |
|
|
|
av_log(s, AV_LOG_ERROR, "Invalid sample rate %d\n", st->codecpar->sample_rate); |
|
|
|
av_log(s, AV_LOG_ERROR, "Invalid sample rate %d\n", st->codecpar->sample_rate); |
|
|
|
return AVERROR_INVALIDDATA; |
|
|
|
return AVERROR_INVALIDDATA; |
|
|
|
} |
|
|
|
} |
|
|
|
st->codecpar->channels = AV_RL32(p + 48); |
|
|
|
channels = AV_RL32(p + 48); |
|
|
|
if (st->codecpar->channels < 1 || st->codecpar->channels > 2) { |
|
|
|
if (channels < 1 || channels > 2) { |
|
|
|
av_log(s, AV_LOG_ERROR, "invalid channel count. Speex must be mono or stereo.\n"); |
|
|
|
av_log(s, AV_LOG_ERROR, "invalid channel count. Speex must be mono or stereo.\n"); |
|
|
|
return AVERROR_INVALIDDATA; |
|
|
|
return AVERROR_INVALIDDATA; |
|
|
|
} |
|
|
|
} |
|
|
|
st->codecpar->channel_layout = st->codecpar->channels == 1 ? AV_CH_LAYOUT_MONO : |
|
|
|
av_channel_layout_default(&st->codecpar->ch_layout, channels); |
|
|
|
AV_CH_LAYOUT_STEREO; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spxp->packet_size = AV_RL32(p + 56); |
|
|
|
spxp->packet_size = AV_RL32(p + 56); |
|
|
|
frames_per_packet = AV_RL32(p + 64); |
|
|
|
frames_per_packet = AV_RL32(p + 64); |
|
|
|