|  |  | @ -34,7 +34,8 @@ extern ExitHandler do_exit; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | // ***** OMX callback functions *****
 |  |  |  | // ***** OMX callback functions *****
 | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | void OmxEncoder::wait_for_state(OMX_STATETYPE state) { |  |  |  | void OmxEncoder::set_state_blocking(OMX_STATETYPE state) { | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |   OMX_CHECK(OMX_SendCommand(this->handle, OMX_CommandStateSet, state, NULL)); | 
			
		
	
		
		
			
				
					
					|  |  |  |   pthread_mutex_lock(&this->state_lock); |  |  |  |   pthread_mutex_lock(&this->state_lock); | 
			
		
	
		
		
			
				
					
					|  |  |  |   while (this->state != state) { |  |  |  |   while (this->state != state) { | 
			
		
	
		
		
			
				
					
					|  |  |  |     pthread_cond_wait(&this->state_cv, &this->state_lock); |  |  |  |     pthread_cond_wait(&this->state_cv, &this->state_lock); | 
			
		
	
	
		
		
			
				
					|  |  | @ -304,7 +305,7 @@ OmxEncoder::OmxEncoder(const char* filename, int width, int height, int fps, int | 
			
		
	
		
		
			
				
					
					|  |  |  |   //   printf("profile %d level 0x%x\n", params.eProfile, params.eLevel);
 |  |  |  |   //   printf("profile %d level 0x%x\n", params.eProfile, params.eLevel);
 | 
			
		
	
		
		
			
				
					
					|  |  |  |   // }
 |  |  |  |   // }
 | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |   OMX_CHECK(OMX_SendCommand(this->handle, OMX_CommandStateSet, OMX_StateIdle, NULL)); |  |  |  |   set_state_blocking(OMX_StateIdle); | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |   for (auto &buf : this->in_buf_headers) { |  |  |  |   for (auto &buf : this->in_buf_headers) { | 
			
		
	
		
		
			
				
					
					|  |  |  |     OMX_CHECK(OMX_AllocateBuffer(this->handle, &buf, PORT_INDEX_IN, this, |  |  |  |     OMX_CHECK(OMX_AllocateBuffer(this->handle, &buf, PORT_INDEX_IN, this, | 
			
		
	
	
		
		
			
				
					|  |  | @ -316,11 +317,7 @@ OmxEncoder::OmxEncoder(const char* filename, int width, int height, int fps, int | 
			
		
	
		
		
			
				
					
					|  |  |  |                              out_port.nBufferSize)); |  |  |  |                              out_port.nBufferSize)); | 
			
		
	
		
		
			
				
					
					|  |  |  |   } |  |  |  |   } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |   wait_for_state(OMX_StateIdle); |  |  |  |   set_state_blocking(OMX_StateExecuting); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |   OMX_CHECK(OMX_SendCommand(this->handle, OMX_CommandStateSet, OMX_StateExecuting, NULL)); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |   wait_for_state(OMX_StateExecuting); |  |  |  |  | 
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |   // give omx all the output buffers
 |  |  |  |   // give omx all the output buffers
 | 
			
		
	
		
		
			
				
					
					|  |  |  |   for (auto &buf : this->out_buf_headers) { |  |  |  |   for (auto &buf : this->out_buf_headers) { | 
			
		
	
	
		
		
			
				
					|  |  | @ -593,11 +590,8 @@ void OmxEncoder::encoder_close() { | 
			
		
	
		
		
			
				
					
					|  |  |  | OmxEncoder::~OmxEncoder() { |  |  |  | OmxEncoder::~OmxEncoder() { | 
			
		
	
		
		
			
				
					
					|  |  |  |   assert(!this->is_open); |  |  |  |   assert(!this->is_open); | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |   OMX_CHECK(OMX_SendCommand(this->handle, OMX_CommandStateSet, OMX_StateIdle, NULL)); |  |  |  |   set_state_blocking(OMX_StateIdle); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |   set_state_blocking(OMX_StateLoaded); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |   wait_for_state(OMX_StateIdle); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |   OMX_CHECK(OMX_SendCommand(this->handle, OMX_CommandStateSet, OMX_StateLoaded, NULL)); |  |  |  |  | 
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |   for (auto &buf : this->in_buf_headers) { |  |  |  |   for (auto &buf : this->in_buf_headers) { | 
			
		
	
		
		
			
				
					
					|  |  |  |     OMX_CHECK(OMX_FreeBuffer(this->handle, PORT_INDEX_IN, buf)); |  |  |  |     OMX_CHECK(OMX_FreeBuffer(this->handle, PORT_INDEX_IN, buf)); | 
			
		
	
	
		
		
			
				
					|  |  | @ -607,8 +601,6 @@ OmxEncoder::~OmxEncoder() { | 
			
		
	
		
		
			
				
					
					|  |  |  |     OMX_CHECK(OMX_FreeBuffer(this->handle, PORT_INDEX_OUT, buf)); |  |  |  |     OMX_CHECK(OMX_FreeBuffer(this->handle, PORT_INDEX_OUT, buf)); | 
			
		
	
		
		
			
				
					
					|  |  |  |   } |  |  |  |   } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |   wait_for_state(OMX_StateLoaded); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |   OMX_CHECK(OMX_FreeHandle(this->handle)); |  |  |  |   OMX_CHECK(OMX_FreeHandle(this->handle)); | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |   OMX_BUFFERHEADERTYPE *out_buf; |  |  |  |   OMX_BUFFERHEADERTYPE *out_buf; | 
			
		
	
	
		
		
			
				
					|  |  | 
 |