fmt->name, score);
for (i = 0; fmt_id_type[i].name; i++) {
if (!strcmp(fmt->name, fmt_id_type[i].name)) {
+ if (fmt_id_type[i].type != AVMEDIA_TYPE_AUDIO &&
+ st->codecpar->sample_rate)
+ continue;
st->codecpar->codec_id = fmt_id_type[i].id;
st->codecpar->codec_type = fmt_id_type[i].type;
st->internal->need_context_update = 1;
if (duration != INT64_MIN && duration > 0 && ic->duration == AV_NOPTS_VALUE) {
ic->duration = duration;
}
- if (ic->pb && (filesize = avio_size(ic->pb)) > 0 && ic->duration != AV_NOPTS_VALUE) {
+ if (ic->pb && (filesize = avio_size(ic->pb)) > 0 && ic->duration > 0) {
/* compute the bitrate */
double bitrate = (double) filesize * 8.0 * AV_TIME_BASE /
(double) ic->duration;
enum AVCodecID ff_get_pcm_codec_id(int bps, int flt, int be, int sflags)
{
+ if (bps > 64U)
+ return AV_CODEC_ID_NONE;
+
if (flt) {
switch (bps) {
case 32: