X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavcodec%2Fvp9_parser.c;h=220290fbf1ec135dd5afc9defddadae7df6dafbb;hb=088dfd3ff15eba342863c74be53f7ca614957966;hp=b188785456b8df09331e74353e0fc1f418848747;hpb=9fb5a91c66934dab395ff32eb524a3dbe08b53d8;p=ffmpeg diff --git a/libavcodec/vp9_parser.c b/libavcodec/vp9_parser.c index b188785456b..220290fbf1e 100644 --- a/libavcodec/vp9_parser.c +++ b/libavcodec/vp9_parser.c @@ -24,10 +24,13 @@ typedef struct VP9ParseContext { int n_frames; // 1-8 int size[8]; + int64_t pts; } VP9ParseContext; static void parse_frame(AVCodecParserContext *ctx, const uint8_t *buf, int size) { + VP9ParseContext *s = ctx->priv_data; + if (buf[0] & 0x4) { ctx->pict_type = AV_PICTURE_TYPE_P; ctx->key_frame = 0; @@ -35,6 +38,15 @@ static void parse_frame(AVCodecParserContext *ctx, const uint8_t *buf, int size) ctx->pict_type = AV_PICTURE_TYPE_I; ctx->key_frame = 1; } + + if (buf[0] & 0x2) { + if (ctx->pts == AV_NOPTS_VALUE) + ctx->pts = s->pts; + s->pts = AV_NOPTS_VALUE; + } else { + s->pts = ctx->pts; + ctx->pts = AV_NOPTS_VALUE; + } } static int parse(AVCodecParserContext *ctx,