You've already forked FFmpeg
							
							
				mirror of
				https://github.com/FFmpeg/FFmpeg.git
				synced 2025-10-30 23:18:11 +02:00 
			
		
		
		
	Set context variable key_frame in H264 parser.
Patch by Ivan Schreter, schreter gmx net Originally committed as revision 17489 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
		
				
					committed by
					
						 Carl Eugen Hoyos
						Carl Eugen Hoyos
					
				
			
			
				
	
			
			
			
						parent
						
							ff6474dd15
						
					
				
				
					commit
					0ed260c7a3
				
			| @@ -118,8 +118,10 @@ static inline int parse_nal_units(AVCodecParserContext *s, | |||||||
|  |  | ||||||
|     /* set some sane default values */ |     /* set some sane default values */ | ||||||
|     s->pict_type = FF_I_TYPE; |     s->pict_type = FF_I_TYPE; | ||||||
|  |     s->key_frame = 0; | ||||||
|  |  | ||||||
|     h->s.avctx= avctx; |     h->s.avctx= avctx; | ||||||
|  |     h->sei_recovery_frame_cnt = -1; | ||||||
|  |  | ||||||
|     for(;;) { |     for(;;) { | ||||||
|         int src_length, dst_length, consumed; |         int src_length, dst_length, consumed; | ||||||
| @@ -152,10 +154,16 @@ static inline int parse_nal_units(AVCodecParserContext *s, | |||||||
|             ff_h264_decode_sei(h); |             ff_h264_decode_sei(h); | ||||||
|             break; |             break; | ||||||
|         case NAL_IDR_SLICE: |         case NAL_IDR_SLICE: | ||||||
|  |             s->key_frame = 1; | ||||||
|  |             /* fall through */ | ||||||
|         case NAL_SLICE: |         case NAL_SLICE: | ||||||
|             get_ue_golomb(&h->s.gb);  // skip first_mb_in_slice |             get_ue_golomb(&h->s.gb);  // skip first_mb_in_slice | ||||||
|             slice_type = get_ue_golomb_31(&h->s.gb); |             slice_type = get_ue_golomb_31(&h->s.gb); | ||||||
|             s->pict_type = golomb_to_pict_type[slice_type % 5]; |             s->pict_type = golomb_to_pict_type[slice_type % 5]; | ||||||
|  |             if (h->sei_recovery_frame_cnt >= 0) { | ||||||
|  |                 /* key frame, since recovery_frame_cnt is set */ | ||||||
|  |                 s->key_frame = 1; | ||||||
|  |             } | ||||||
|             return 0; /* no need to evaluate the rest */ |             return 0; /* no need to evaluate the rest */ | ||||||
|         } |         } | ||||||
|         buf += consumed; |         buf += consumed; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user