From 5ba7c3d7c9c53afad5e13203011619cff579b7ba Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Fri, 22 Oct 2004 01:51:17 +0000 Subject: [PATCH] set keyframe flag at a more central place instead of in every demuxer for containers which only store intra only streams Originally committed as revision 3620 to svn://svn.ffmpeg.org/ffmpeg/trunk --- libavformat/au.c | 1 - libavformat/utils.c | 24 ++++++++++++++++++++++++ libavformat/wav.c | 1 - 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/libavformat/au.c b/libavformat/au.c index 1721902623..1709c874ec 100644 --- a/libavformat/au.c +++ b/libavformat/au.c @@ -164,7 +164,6 @@ static int au_read_packet(AVFormatContext *s, if (av_new_packet(pkt, MAX_SIZE)) return AVERROR_IO; pkt->stream_index = 0; - pkt->flags |= PKT_FLAG_KEY; ret = get_buffer(&s->pb, pkt->data, pkt->size); if (ret < 0) diff --git a/libavformat/utils.c b/libavformat/utils.c index 672c43e204..1c0dd2939b 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -591,6 +591,27 @@ static void compute_frame_duration(int *pnum, int *pden, AVStream *st, } } +static int is_intra_only(AVCodecContext *enc){ + if(enc->codec_type == CODEC_TYPE_AUDIO){ + return 1; + }else if(enc->codec_type == CODEC_TYPE_VIDEO){ + switch(enc->codec_id){ + case CODEC_ID_MJPEG: + case CODEC_ID_MJPEGB: + case CODEC_ID_LJPEG: + case CODEC_ID_RAWVIDEO: + case CODEC_ID_DVVIDEO: + case CODEC_ID_HUFFYUV: + case CODEC_ID_ASV1: + case CODEC_ID_ASV2: + case CODEC_ID_VCR1: + return 1; + default: break; + } + } + return 0; +} + static int64_t lsb2full(int64_t lsb, int64_t last_ts, int lsb_bits){ int64_t mask = lsb_bits < 64 ? (1LL<codec)) + pkt->flags |= PKT_FLAG_KEY; + /* do we have a video B frame ? */ presentation_delayed = 0; if (st->codec.codec_type == CODEC_TYPE_VIDEO) { diff --git a/libavformat/wav.c b/libavformat/wav.c index 2d28b8f2cf..4528c8356d 100644 --- a/libavformat/wav.c +++ b/libavformat/wav.c @@ -331,7 +331,6 @@ static int wav_read_packet(AVFormatContext *s, if (av_new_packet(pkt, size)) return AVERROR_IO; pkt->stream_index = 0; - pkt->flags |= PKT_FLAG_KEY; ret = get_buffer(&s->pb, pkt->data, pkt->size); if (ret < 0)