aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorDavid Conrad <lessen42@gmail.com>2009-12-12 20:18:46 +0000
committerDavid Conrad <lessen42@gmail.com>2009-12-12 20:18:46 +0000
commitc39b94be600e8433a1de54b09d86704066efeb27 (patch)
treedcfa43f0b8040a23a6d3d6f26942886cbb91b657 /libavcodec
parent5e15c7d95be456e9dafbcca7cb0d936cc331dbae (diff)
downloadffmpeg-c39b94be600e8433a1de54b09d86704066efeb27.tar.gz
libtheoraenc.c: mark keyframes
Originally committed as revision 20816 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/libtheoraenc.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/libavcodec/libtheoraenc.c b/libavcodec/libtheoraenc.c
index fd4a9ec415..6a9dee167f 100644
--- a/libavcodec/libtheoraenc.c
+++ b/libavcodec/libtheoraenc.c
@@ -46,6 +46,7 @@ typedef struct TheoraContext {
int stats_offset;
int uv_hshift;
int uv_vshift;
+ int keyframe_mask;
} TheoraContext;
/*!
@@ -218,6 +219,7 @@ static av_cold int encode_init(AVCodecContext* avc_context)
return -1;
}
+ h->keyframe_mask = (1 << t_info.keyframe_granule_shift) - 1;
/* Clear up theora_info struct */
th_info_clear(&t_info);
@@ -336,6 +338,7 @@ static int encode_frame(AVCodecContext* avc_context, uint8_t *outbuf,
// HACK: does not take codec delay into account (neither does the decoder though)
avc_context->coded_frame->pts = frame->pts;
+ avc_context->coded_frame->key_frame = !(o_packet.granulepos & h->keyframe_mask);
return o_packet.bytes;
}