}
#endif
- str_size_alloc = str_size << 1; // worst-case requirement for output string in case of utf8 coded input
- str = av_malloc(str_size_alloc);
- if (!str)
- return AVERROR(ENOMEM);
-
if (!key)
return 0;
if (atom.size < 0)
return AVERROR_INVALIDDATA;
+ str_size_alloc = str_size << 1; // worst-case requirement for output string in case of utf8 coded input
+ str = av_malloc(str_size_alloc);
+ if (!str)
+ return AVERROR(ENOMEM);
+
if (parse)
parse(c, pb, str_size, key);
else {
mov_read_mac_string(c, pb, str_size, str, str_size_alloc);
} else {
int ret = avio_read(pb, str, str_size);
- if (ret != str_size)
+ if (ret != str_size) {
+ av_freep(&str);
return ret < 0 ? ret : AVERROR_INVALIDDATA;
+ }
str[str_size] = 0;
}
c->fc->event_flags |= AVFMT_EVENT_FLAG_METADATA_UPDATED;
}
}
+ if (mov->use_mfra_for > 0) {
+ for (i = 0; i < s->nb_streams; i++) {
+ AVStream *st = s->streams[i];
+ MOVStreamContext *sc = st->priv_data;
+ if (sc->duration_for_fps > 0) {
+ st->codec->bit_rate = sc->data_size * 8 * sc->time_scale /
+ sc->duration_for_fps;
+ }
+ }
+ }
+
for (i = 0; i < mov->bitrates_count && i < s->nb_streams; i++) {
if (mov->bitrates[i]) {
s->streams[i]->codec->bit_rate = mov->bitrates[i];