|  |  |  | @ -16,7 +16,6 @@ | 
			
		
	
		
			
				
					|  |  |  |  | #include <OMX_QCOMExtns.h> | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | #include <libyuv.h> | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | #include <msm_media_info.h> | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | #include "common/mutex.h" | 
			
		
	
	
		
			
				
					|  |  |  | @ -25,10 +24,6 @@ | 
			
		
	
		
			
				
					|  |  |  |  | #include "encoder.h" | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | // encoder: lossey codec using hardware hevc
 | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | // ***** OMX callback functions *****
 | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | static void wait_for_state(EncoderState *s, OMX_STATETYPE state) { | 
			
		
	
	
		
			
				
					|  |  |  | @ -284,23 +279,23 @@ void encoder_init(EncoderState *s, const char* filename, int width, int height, | 
			
		
	
		
			
				
					|  |  |  |  |   if (h265) { | 
			
		
	
		
			
				
					|  |  |  |  |     // setup HEVC
 | 
			
		
	
		
			
				
					|  |  |  |  |   #ifndef QCOM2 | 
			
		
	
		
			
				
					|  |  |  |  |       OMX_VIDEO_PARAM_HEVCTYPE hecv_type = {0}; | 
			
		
	
		
			
				
					|  |  |  |  |     OMX_VIDEO_PARAM_HEVCTYPE hevc_type = {0}; | 
			
		
	
		
			
				
					|  |  |  |  |     OMX_INDEXTYPE index_type = (OMX_INDEXTYPE) OMX_IndexParamVideoHevc; | 
			
		
	
		
			
				
					|  |  |  |  |   #else | 
			
		
	
		
			
				
					|  |  |  |  |       OMX_VIDEO_PARAM_PROFILELEVELTYPE hecv_type = {0}; | 
			
		
	
		
			
				
					|  |  |  |  |     OMX_VIDEO_PARAM_PROFILELEVELTYPE hevc_type = {0}; | 
			
		
	
		
			
				
					|  |  |  |  |     OMX_INDEXTYPE index_type = OMX_IndexParamVideoProfileLevelCurrent; | 
			
		
	
		
			
				
					|  |  |  |  |   #endif | 
			
		
	
		
			
				
					|  |  |  |  |       hecv_type.nSize = sizeof(hecv_type); | 
			
		
	
		
			
				
					|  |  |  |  |       hecv_type.nPortIndex = (OMX_U32) PORT_INDEX_OUT; | 
			
		
	
		
			
				
					|  |  |  |  |     hevc_type.nSize = sizeof(hevc_type); | 
			
		
	
		
			
				
					|  |  |  |  |     hevc_type.nPortIndex = (OMX_U32) PORT_INDEX_OUT; | 
			
		
	
		
			
				
					|  |  |  |  |     err = OMX_GetParameter(s->handle, index_type, | 
			
		
	
		
			
				
					|  |  |  |  |                              (OMX_PTR) &hecv_type); | 
			
		
	
		
			
				
					|  |  |  |  |                            (OMX_PTR) &hevc_type); | 
			
		
	
		
			
				
					|  |  |  |  |     assert(err == OMX_ErrorNone); | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |       hecv_type.eProfile = OMX_VIDEO_HEVCProfileMain; | 
			
		
	
		
			
				
					|  |  |  |  |       hecv_type.eLevel = OMX_VIDEO_HEVCHighTierLevel5; | 
			
		
	
		
			
				
					|  |  |  |  |     hevc_type.eProfile = OMX_VIDEO_HEVCProfileMain; | 
			
		
	
		
			
				
					|  |  |  |  |     hevc_type.eLevel = OMX_VIDEO_HEVCHighTierLevel5; | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |     err = OMX_SetParameter(s->handle, index_type, | 
			
		
	
		
			
				
					|  |  |  |  |                              (OMX_PTR) &hecv_type); | 
			
		
	
		
			
				
					|  |  |  |  |                            (OMX_PTR) &hevc_type); | 
			
		
	
		
			
				
					|  |  |  |  |     assert(err == OMX_ErrorNone); | 
			
		
	
		
			
				
					|  |  |  |  |   } else { | 
			
		
	
		
			
				
					|  |  |  |  |     // setup h264
 | 
			
		
	
	
		
			
				
					|  |  |  | @ -588,11 +583,11 @@ void encoder_open(EncoderState *s, const char* path) { | 
			
		
	
		
			
				
					|  |  |  |  |   } else { | 
			
		
	
		
			
				
					|  |  |  |  |     s->of = fopen(s->vid_path, "wb"); | 
			
		
	
		
			
				
					|  |  |  |  |     assert(s->of); | 
			
		
	
		
			
				
					|  |  |  |  |     if (s->codec_config_len > 0) { | 
			
		
	
		
			
				
					|  |  |  |  | #ifndef QCOM2 | 
			
		
	
		
			
				
					|  |  |  |  |     if (s->codec_config_len > 0) { | 
			
		
	
		
			
				
					|  |  |  |  |       fwrite(s->codec_config, s->codec_config_len, 1, s->of); | 
			
		
	
		
			
				
					|  |  |  |  | #endif | 
			
		
	
		
			
				
					|  |  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  |  | #endif | 
			
		
	
		
			
				
					|  |  |  |  |   } | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |   // create camera lock file
 | 
			
		
	
	
		
			
				
					|  |  |  | @ -699,6 +694,13 @@ void encoder_destroy(EncoderState *s) { | 
			
		
	
		
			
				
					|  |  |  |  |   err = OMX_FreeHandle(s->handle); | 
			
		
	
		
			
				
					|  |  |  |  |   assert(err == OMX_ErrorNone); | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |   while (queue_try_pop(&s->free_in)); 
 | 
			
		
	
		
			
				
					|  |  |  |  |   while (queue_try_pop(&s->done_out)); 
 | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |   if (s->codec_config) { | 
			
		
	
		
			
				
					|  |  |  |  |     free(s->codec_config); | 
			
		
	
		
			
				
					|  |  |  |  |   } | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |   if (s->downscale) { | 
			
		
	
		
			
				
					|  |  |  |  |     free(s->y_ptr2); | 
			
		
	
		
			
				
					|  |  |  |  |     free(s->u_ptr2); | 
			
		
	
	
		
			
				
					|  |  |  | 
 |