if (ret < 0)
return ret;
+ if (pkt.size >= 8 && id != AV_CODEC_ID_BMP) {
+ if (AV_RB64(pkt.data) == 0x89504e470d0a1a0a) {
+ id = AV_CODEC_ID_PNG;
+ } else {
+ id = AV_CODEC_ID_MJPEG;
+ }
+ }
+
st->disposition |= AV_DISPOSITION_ATTACHED_PIC;
st->attached_pic = pkt;
int64_t dts;
int data_offset = 0;
unsigned entries, first_sample_flags = frag->flags;
- int flags, distance, i, found_keyframe = 0, err;
+ int flags, distance, i, err;
for (i = 0; i < c->fc->nb_streams; i++) {
if (c->fc->streams[i]->id == frag->track_id) {
sc->ctts_count++;
if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO)
keyframe = 1;
- else if (!found_keyframe)
- keyframe = found_keyframe =
+ else
+ keyframe =
!(sample_flags & (MOV_FRAG_SAMPLE_FLAG_IS_NON_SYNC |
MOV_FRAG_SAMPLE_FLAG_DEPENDS_YES));
if (keyframe)
goto retry;
pkt->flags |= sample->flags & AVINDEX_KEYFRAME ? AV_PKT_FLAG_KEY : 0;
pkt->pos = sample->pos;
- av_log(s, AV_LOG_TRACE, "stream %d, pts %"PRId64", dts %"PRId64", pos 0x%"PRIx64", duration %d\n",
+ av_log(s, AV_LOG_TRACE, "stream %d, pts %"PRId64", dts %"PRId64", pos 0x%"PRIx64", duration %"PRId64"\n",
pkt->stream_index, pkt->pts, pkt->dts, pkt->pos, pkt->duration);
return 0;
}