*/
#include <limits.h>
+#include <stdint.h>
//#define MOV_EXPORT_ALL_METADATA
static int mov_read_ares(MOVContext *c, AVIOContext *pb, MOVAtom atom)
{
- AVCodecContext *codec = c->fc->streams[c->fc->nb_streams-1]->codec;
- if (codec->codec_tag == MKTAG('A', 'V', 'i', 'n') &&
- codec->codec_id == AV_CODEC_ID_H264 &&
- atom.size > 11) {
- avio_skip(pb, 10);
- /* For AVID AVCI50, force width of 1440 to be able to select the correct SPS and PPS */
- if (avio_rb16(pb) == 0xd4d)
- codec->width = 1440;
- return 0;
+ if (c->fc->nb_streams >= 1) {
+ AVCodecContext *codec = c->fc->streams[c->fc->nb_streams-1]->codec;
+ if (codec->codec_tag == MKTAG('A', 'V', 'i', 'n') &&
+ codec->codec_id == AV_CODEC_ID_H264 &&
+ atom.size > 11) {
+ avio_skip(pb, 10);
+ /* For AVID AVCI50, force width of 1440 to be able to select the correct SPS and PPS */
+ if (avio_rb16(pb) == 0xd4d)
+ codec->width = 1440;
+ return 0;
+ }
}
return mov_read_avid(c, pb, atom);
// done for ai5q, ai52, ai55, ai1q, ai12 and ai15.
if (!st->codec->extradata_size && st->codec->codec_id == AV_CODEC_ID_H264 &&
- st->codec->codec_tag != MKTAG('a', 'v', 'c', '1')) {
- ff_generate_avci_extradata(st);
+ TAG_IS_AVCI(st->codec->codec_tag)) {
+ ret = ff_generate_avci_extradata(st);
+ if (ret < 0)
+ return ret;
}
switch (st->codec->codec_id) {