3

I have a weird problem with a Raspberry Pi 2 (model b).

I'm compiling the following program in GCC in Raspbian Jessie (Linux raspberrypi 4.4.11-v7+ #888 SMP Mon May 23 20:10:33 BST 2016 armv7l GNU/Linux). I have a standard HDMI TV dual output with a Waveshare 3.2" LCD (only 'weird' thing I did).

I'm trying to get omxplayer to run (in a way that I can kill), but it doesn't seem to be launching. I've deleted most of the code, and this is about how far I can get with it still not launching. If I delete any of the earlier variables, then it works as expected. Anyone have a clue what's going on? Any advice on getting it up and running with a bigger program?

#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/wait.h>

int main()
{
   int xres, yres;
   int buttonCoords2[4] = {2,3,4,5};
   int      button2= 1;
   int      button3= 1;
   int      button4= 1;

   xres = 320;
   yres = 240;

   pid_t pid = fork();
   if (pid==0) {
      execl("/usr/bin/omxplayer", "omxplayer", "-p", "-o", "hdmi", "/home/pi/Short.mp4");
      exit(127);
   }
   else {
      waitpid(pid, 0, 0);
   }
}

closed as off-topic by goldilocks Oct 5 '16 at 14:23

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question does not appear to be specific to the Raspberry Pi within the scope defined in the help center." – goldilocks
If this question can be reworded to fit the rules in the help center, please edit the question.

0

Turns out I was missing a NULL at the end of the execl statement. The line should have read:

execl("/usr/bin/omxplayer", "omxplayer", "-p", "-o", "hdmi", "/home/pi/Short.mp4", NULL);

Though technically, (char *) 0 would have been more appropriate.

Not the answer you're looking for? Browse other questions tagged or ask your own question.