Page 1 of 1

hello_video play/pause via GPIO

Posted: Tue May 15, 2018 7:29 pm
by FlyingDrMike
My target is a looping video that I can pause/restart (from where paused) via a GPIO. I have the pause part working but it is not restarting.

I am editing the video.c file and am using wiringPi for the GPIO.

In order to loop I replaced 'break' with 'rewind(in)' after the if(!data_len) so this now looks like:

Code: Select all

         if(!data_len)
            rewind(in); //this makes the video seamless continuous looping 
Then I use a uint8_t pp (play-pause) from the GPIO read and ppp (previous play-pause) to pick up changes in the pp input. I am pausing by changing the video_render state to Pause and then on release of the input (pp to HIGH) changing this back to Executing. The pause works but not the return to Executing.

The following code is inserted above the code above:

Code: Select all

		 pp = digitalRead(17);
		 if(ppp == 1 && pp == 0)
			 ilclient_change_component_state(video_render, OMX_StatePause);
		 if(ppp == 0 && pp == 1)
			 ilclient_change_component_state(video_render, OMX_StateExecuting);
		 ppp = pp;
This is my first use of hello_video and my pi experience close to novice, hence any guidance to get this working would be much appreciated.

Mike