| 
				
				
					
				
				
				 | 
			
			 | 
			@@ -23,6 +23,7 @@ | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			#include "libavutil/intreadwrite.h" | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			#include "libavutil/intfloat.h" | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			#include "libavutil/imgutils.h" | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			#include "libavutil/timecode.h" | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			#include "bytestream.h" | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			#include "avcodec.h" | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			#include "internal.h" | 
		
		
	
	
		
			
				| 
				
					
				
				
					
				
				
				 | 
			
			 | 
			@@ -239,6 +240,34 @@ static int decode_frame(AVCodecContext *avctx, | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			        } | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			    } | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
  | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			    /* SMPTE TC from television header */ | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			    if (offset >= 1920 + 4) { | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			        uint32_t tc; | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			        uint32_t *tc_sd; | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			        char tcbuf[AV_TIMECODE_STR_SIZE]; | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
  | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			        buf = avpkt->data + 1920; | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			        // read32 to native endian, av_bswap32 to opposite of native for | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			        // compatibility with av_timecode_make_smpte_tc_string2 etc | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			        tc = av_bswap32(read32(&buf, endian)); | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
  | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			        if (i != 0xFFFFFFFF) { | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			            AVFrameSideData *tcside = | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			                av_frame_new_side_data(p, AV_FRAME_DATA_S12M_TIMECODE, | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			                                       sizeof(uint32_t) * 4); | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			            if (!tcside) | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			                return AVERROR(ENOMEM); | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
  | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			            tc_sd = (uint32_t*)tcside->data; | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			            tc_sd[0] = 1; | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			            tc_sd[1] = tc; | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
  | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			            av_timecode_make_smpte_tc_string2(tcbuf, avctx->framerate, | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			                                              tc_sd[1], 0, 0); | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			            av_dict_set(&p->metadata, "timecode", tcbuf, 0); | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			        } | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			    } | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
  | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			    switch (descriptor) { | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			    case 6:  // Y | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			        elements = 1; | 
		
		
	
	
		
			
				| 
				
					
				
				
				
				 | 
			
			 | 
			
  |