Commit 885da7b0 authored by Anton Khirnov's avatar Anton Khirnov

lavf: simplify is_intra_only() by using codec descriptors.

parent 51efed15
...@@ -789,30 +789,14 @@ static void compute_frame_duration(int *pnum, int *pden, AVStream *st, ...@@ -789,30 +789,14 @@ static void compute_frame_duration(int *pnum, int *pden, AVStream *st,
} }
} }
static int is_intra_only(AVCodecContext *enc){ static int is_intra_only(enum AVCodecID id)
if(enc->codec_type == AVMEDIA_TYPE_AUDIO){ {
return 1; const AVCodecDescriptor *d = avcodec_descriptor_get(id);
}else if(enc->codec_type == AVMEDIA_TYPE_VIDEO){ if (!d)
switch(enc->codec_id){ return 0;
case AV_CODEC_ID_MJPEG: if (d->type == AVMEDIA_TYPE_VIDEO && !(d->props & AV_CODEC_PROP_INTRA_ONLY))
case AV_CODEC_ID_MJPEGB: return 0;
case AV_CODEC_ID_LJPEG: return 1;
case AV_CODEC_ID_PRORES:
case AV_CODEC_ID_RAWVIDEO:
case AV_CODEC_ID_DVVIDEO:
case AV_CODEC_ID_HUFFYUV:
case AV_CODEC_ID_FFVHUFF:
case AV_CODEC_ID_ASV1:
case AV_CODEC_ID_ASV2:
case AV_CODEC_ID_VCR1:
case AV_CODEC_ID_DNXHD:
case AV_CODEC_ID_JPEG2000:
case AV_CODEC_ID_MDEC:
return 1;
default: break;
}
}
return 0;
} }
static void update_initial_timestamps(AVFormatContext *s, int stream_index, static void update_initial_timestamps(AVFormatContext *s, int stream_index,
...@@ -1034,7 +1018,7 @@ static void compute_pkt_fields(AVFormatContext *s, AVStream *st, ...@@ -1034,7 +1018,7 @@ static void compute_pkt_fields(AVFormatContext *s, AVStream *st,
// av_log(NULL, AV_LOG_ERROR, "OUTdelayed:%d/%d pts:%"PRId64", dts:%"PRId64" cur_dts:%"PRId64"\n", presentation_delayed, delay, pkt->pts, pkt->dts, st->cur_dts); // av_log(NULL, AV_LOG_ERROR, "OUTdelayed:%d/%d pts:%"PRId64", dts:%"PRId64" cur_dts:%"PRId64"\n", presentation_delayed, delay, pkt->pts, pkt->dts, st->cur_dts);
/* update flags */ /* update flags */
if(is_intra_only(st->codec)) if (is_intra_only(st->codec->codec_id))
pkt->flags |= AV_PKT_FLAG_KEY; pkt->flags |= AV_PKT_FLAG_KEY;
if (pc) if (pc)
pkt->convergence_duration = pc->convergence_duration; pkt->convergence_duration = pc->convergence_duration;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment