#include "avi.h"
#include "dv.h"
#include "internal.h"
+#include "isom.h"
#include "riff.h"
#include "libavcodec/bytestream.h"
#include "libavcodec/exif.h"
-#include "libavformat/isom.h"
+#include "libavcodec/internal.h"
typedef struct AVIStream {
int64_t frame_offset; /* current frame (video) or byte (audio) counter
av_dlog(s,
"longs_pre_entry:%d index_type:%d entries_in_use:%d "
- "chunk_id:%X base:%16"PRIX64"\n",
+ "chunk_id:%X base:%16"PRIX64" frame_num:%d\n",
longs_pre_entry,
index_type,
entries_in_use,
chunk_id,
- base);
+ base,
+ frame_num);
if (stream_id >= s->nb_streams || stream_id < 0)
return AVERROR_INVALIDDATA;
st->codec->codec_tag = tag1;
st->codec->codec_id = ff_codec_get_id(ff_codec_bmp_tags,
tag1);
+ /* If codec is not found yet, try with the mov tags. */
if (!st->codec->codec_id) {
- st->codec->codec_id = ff_codec_get_id(ff_codec_movvideo_tags,
- tag1);
+ char tag_buf[32];
+ av_get_codec_tag_string(tag_buf, sizeof(tag_buf), tag1);
+ st->codec->codec_id =
+ ff_codec_get_id(ff_codec_movvideo_tags, tag1);
if (st->codec->codec_id)
- av_log(s, AV_LOG_WARNING, "mov tag found in avi\n");
+ av_log(s, AV_LOG_WARNING,
+ "mov tag found in avi (fourcc %s)\n",
+ tag_buf);
}
/* This is needed to get the pict type which is necessary
* for generating correct pts. */
if (index >= 0 && e->timestamp == ast->frame_offset) {
if (index == st->nb_index_entries-1) {
int key=1;
- int i;
uint32_t state=-1;
- for (i=0; i<FFMIN(size,256); i++) {
- if (st->codec->codec_id == AV_CODEC_ID_MPEG4) {
- if (state == 0x1B6) {
- key= !(pkt->data[i]&0xC0);
+ if (st->codec->codec_id == AV_CODEC_ID_MPEG4) {
+ const uint8_t *ptr = pkt->data, *end = ptr + FFMIN(size, 256);
+ while (ptr < end) {
+ ptr = avpriv_find_start_code(ptr, end, &state);
+ if (state == 0x1B6 && ptr < end) {
+ key = !(*ptr & 0xC0);
break;
}
- }else
- break;
- state= (state<<8) + pkt->data[i];
+ }
}
if (!key)
e->flags &= ~AVINDEX_KEYFRAME;