[FFmpeg-cvslog] r20816 - trunk/libavcodec/libtheoraenc.c

conrad subversion
Sat Dec 12 21:18:46 CET 2009


Author: conrad
Date: Sat Dec 12 21:18:46 2009
New Revision: 20816

Log:
libtheoraenc.c: mark keyframes

Modified:
   trunk/libavcodec/libtheoraenc.c

Modified: trunk/libavcodec/libtheoraenc.c
==============================================================================
--- trunk/libavcodec/libtheoraenc.c	Sat Dec 12 21:18:43 2009	(r20815)
+++ trunk/libavcodec/libtheoraenc.c	Sat Dec 12 21:18:46 2009	(r20816)
@@ -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(AVCodecCo
         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* 
 
     // 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;
 }



More information about the ffmpeg-cvslog mailing list