Package: jahshaka
Version: cvs.2003-11-30
Author: Guillem Jover <guillem@hadrons.org>
Status: not-sent
Description:
 Fixed for C89 conformance.

diff -Naur jahshaka.orig/jah/encoders/mpeg_encode/mpegmain.c jahshaka/jah/encoders/mpeg_encode/mpegmain.c
--- jahshaka.orig/jah/encoders/mpeg_encode/mpegmain.c	2003-11-30 18:13:46.000000000 +0100
+++ jahshaka/jah/encoders/mpeg_encode/mpegmain.c	2003-11-30 20:06:38.000000000 +0100
@@ -178,51 +178,49 @@
 mpegmain(int argcc, char **argvv, char **rerere)
 
 {
+    //hardcoded parameter file
+    char *rere="/tmp/flipMPEG-root.param";
+    //char *argv="/tmp/flipMPEG-root.param";
+    int argc = 1;
 
-
-	whichGOP = -1;
-	childProcess = FALSE;
-	ioServer = FALSE;
-	outputServer = FALSE;
-	decodeServer = FALSE;
-	quietTime = 0;
-  realQuiet = FALSE;
-	frameSummary = TRUE;
-  debugSockets = FALSE;
-  debugMachines = FALSE;
-  showBitRatePerFrame = FALSE;
-	computeMVHist = FALSE;
-  pureDCT=FALSE;
-
-
-//hardcoded parameter file
-char * rere="/tmp/flipMPEG-root.param";
-//char * argv="/tmp/flipMPEG-root.param";
-int argc = 1;
-
-//*rerere="wewewe";
+    //*rerere="wewewe";
 
     FILE *ofp = NULL;
     register int index;
-    int	    function = ENCODE_FRAMES;
-    int	    portNumber = 0;
+    int     function = ENCODE_FRAMES;
+    int     portNumber = 0;
     char    *hostName = NULL;
     int32   totalTime = -1;
-    int	    maxMachines = 0x7fffffff;
-    int	    outputFrames = 0;
+    int     maxMachines = 0x7fffffff;
+    int     outputFrames = 0;
     time_t  initTimeStart;
     time_t  framesTimeStart, framesTimeEnd;
 
+    whichGOP = -1;
+    childProcess = FALSE;
+    ioServer = FALSE;
+    outputServer = FALSE;
+    decodeServer = FALSE;
+    quietTime = 0;
+    realQuiet = FALSE;
+    frameSummary = TRUE;
+    debugSockets = FALSE;
+    debugMachines = FALSE;
+    showBitRatePerFrame = FALSE;
+    computeMVHist = FALSE;
+    pureDCT = FALSE;
+
     CompileTests();
     time(&initTimeStart);
     SetStatFileName("");
 
-
-
-     if ( ! ReadParamFile(rere, function) ) { *rerere ="ERROR cant find paramfile"; return 1;}
+    if ( !ReadParamFile(rere, function) ) {
+        *rerere ="ERROR cant find paramfile";
+        return 1;
+    }
 
     /* Jim Boucher's stuff:
-	if we are using a movie format then break up into frames*/
+       if we are using a movie format then break up into frames*/
     if ( (!childProcess) && (baseFormat == JMOVIE_FILE_TYPE) ) {
          JM2JPEG();
     }
diff -Naur jahshaka.orig/jah/encoders/mpeg_play/mpegplay.c jahshaka/jah/encoders/mpeg_play/mpegplay.c
--- jahshaka.orig/jah/encoders/mpeg_play/mpegplay.c	2003-11-30 18:13:46.000000000 +0100
+++ jahshaka/jah/encoders/mpeg_play/mpegplay.c	2003-11-30 20:02:29.000000000 +0100
@@ -227,84 +227,71 @@
 //need to fix this so it only plays 1 clip
 //for better memory handling
 
-void mainplay(int argcc,char **argvv)
-
+void mainplay(int argcc, char **argvv)
 {
-
 #ifdef DCPREC
-/* Declaration of global variable to hold DC precision */
-int dcprec = 0;
+  /* Declaration of global variable to hold DC precision */
+  int dcprec = 0;
 #endif
 
-/* Global file pointer to incoming data. */
-FILE **input;
-char **inputName;
+  /* Global file pointer to incoming data. */
+  FILE **input;
+  char **inputName;
 
-/* Loop flag. */
-loopFlag = 0;
+  /* Shared memory flag. */
+  int shmemFlag = 0;
 
-/* Shared memory flag. */
-int shmemFlag = 0;
+  /* Brown - put X specific variables in xinfo struct */
+#define NUMMOVIES 1
+  XInfo xinfo[NUMMOVIES];
 
-framerate = -1;
+  //hardcoded parameter file
+  char *argvev= *argvv;
+  char *argve = "-dither color /root/jahstorage/media/encoded/AnimationClip2.mpg";
+  char **argv = *argve; //"-dither color /root/jahshaka/renders/AnimClip4_.mpg";
+  //char * argv="/tmp/flipMPEG-root.param";
+  int argc = 3;
+
+  char *name;
+  static VidStream **theStream;
+  int mark;
+  int i, mult, largy, y, lastStream, firstStream = -1, workToDo = TRUE;
+  int doDisplay = 0; /* Current movie is displaying on screen */
+  long seekValue = 0;/* holds value before it is put in vid_stream */
+  int  owncmFlag = 0;   /* holds value before it is put in xinfo  */
+  BOOLEAN firstRead = FALSE;
+  int ppm_width = -1,  ppm_height = -1, ppm_modulus = -1;
 
-/* Flag for high quality at the expense of speed */
-#ifdef QUALITY
- qualityFlag = 1;
-#else
- qualityFlag = 0;
-#endif
 
+  /* Loop flag. */
+  loopFlag = 0;
 
+  framerate = -1;
 
+  /* Flag for high quality at the expense of speed */
+#ifdef QUALITY
+  qualityFlag = 1;
+#else
+  qualityFlag = 0;
+#endif
 
-/* Flags/values to control Arbitrary start/stop frames. */
-partialFlag = 0; startFrame = -1; endFrame = -1;
+  /* Flags/values to control Arbitrary start/stop frames. */
+  partialFlag = 0; startFrame = -1; endFrame = -1;
 
-/* Flag for gamma correction */
+  /* Flag for gamma correction */
   gammaCorrectFlag = 0;
   gammaCorrect = 1.0;
 
-/* Flag for chroma correction */
+  /* Flag for chroma correction */
   chromaCorrectFlag = 0;
   chromaCorrect = 1.0;
 
-
-
-
-
-
-
-/* Brown - put X specific variables in xinfo struct */
-#define NUMMOVIES 1
-XInfo xinfo[NUMMOVIES];
-numInput=0;
-
-
-
-
-
-
+  numInput=0;
 
   fprintf(stderr, ">>starting player...");
 
-  //hardcoded parameter file
-  char * argve="-dither color /root/jahstorage/media/encoded/AnimationClip2.mpg";
-  char ** argv= *argve;//"-dither color /root/jahshaka/renders/AnimClip4_.mpg";
-  //char * argv="/tmp/flipMPEG-root.param";
-  int argc = 3;
   fprintf(stderr, ">>we made it here...");
 
-  char *name;
-  static VidStream **theStream;
-  int mark;
-  int i, mult, largy, y, lastStream, firstStream=-1, workToDo=TRUE;
-  int doDisplay=0; /* Current movie is displaying on screen */
-  long seekValue=0;/* holds value before it is put in vid_stream */
-  int  owncmFlag=0;   /* holds value before it is put in xinfo  */
-  BOOLEAN firstRead=FALSE;
-  int ppm_width = -1,  ppm_height = -1, ppm_modulus = -1;
-
   mark = 1;
   argc--;
 
@@ -324,7 +311,6 @@
   }
   name = (char *) "";
 
-
 #ifndef DISABLE_DITHER
 #ifndef DEFAULT_ORDERED_DITHER
   xinfo[0].ditherType = FULL_COLOR_DITHER;
@@ -341,32 +327,25 @@
   shmemFlag = 1;
 #endif
 
-
-
-///////////////////////////////////////////////////
-//we open the file here
-
-  char * argvev=*argvv;
+  ///////////////////////////////////////////////////
+  //we open the file here
 
   xinfo[0].ditherType = FULL_COLOR_DITHER;
 
   input[numInput]=fopen(argvev, "r");
 
-
   if (input[numInput] == NULL) {
     fprintf(stderr, "Could not open file");
     return;
   }
 
-///////////////////////////////////////////////////
-// file has been opened
-
+  ///////////////////////////////////////////////////
+  // file has been opened
 
   fprintf(stderr, ">>we made it here... opened clip");
 
   inputName[numInput++] = argvev;
 
-
   lum_values = (int *) malloc(LUM_RANGE*sizeof(int));
   cr_values = (int *) malloc(CR_RANGE*sizeof(int));
   cb_values = (int *) malloc(CB_RANGE*sizeof(int));
@@ -397,60 +376,60 @@
     xinfo[i].gc = 0;
   }
 
-    InitColorDisplay(name, &xinfo[0]);
-    InitColorDither(xinfo[0].depth>=24);
-
+  InitColorDisplay(name, &xinfo[0]);
+  InitColorDither(xinfo[0].depth>=24);
 
 #ifdef SH_MEM
-    if (shmemFlag && (xinfo[0].display != NULL)) {
-      if (!XShmQueryExtension(xinfo[0].display)) {
-        shmemFlag = 0;
-        if (!quietFlag) {
-          fprintf(stderr, "Shared memory not supported\n");
-          fprintf(stderr, "Reverting to normal Xlib.\n");
-        }
+  if (shmemFlag && (xinfo[0].display != NULL)) {
+    if (!XShmQueryExtension(xinfo[0].display)) {
+      shmemFlag = 0;
+      if (!quietFlag) {
+        fprintf(stderr, "Shared memory not supported\n");
+        fprintf(stderr, "Reverting to normal Xlib.\n");
       }
     }
+  }
 #endif
 
   InitCrop();
 
-  y=300;
-  largy=0;
-  for (i=0;i<numInput;i++) {
-    doDisplay=!noDisplayFlag;
+  y = 300;
+  largy = 0;
+  for (i = 0; i < numInput; i++) {
+    doDisplay = !noDisplayFlag;
 #ifndef DISABLE_DITHER
     if ((xinfo[i].ditherType == NO_DITHER) ||
         (xinfo[i].ditherType == PPM_DITHER))
-       doDisplay = FALSE;
+      doDisplay = FALSE;
 #endif
-    lastStream = i-1;
-    while ((lastStream>=0) && (theStream[lastStream]==NULL)) {
-       lastStream--;
+    lastStream = i - 1;
+    while ((lastStream >= 0) && (theStream[lastStream] == NULL)) {
+      lastStream--;
     }
     if ((i != 0) && doDisplay) {
-       if (lastStream > -1) {
-         xinfo[i].hints.x =
-            xinfo[lastStream].hints.x+10 + theStream[lastStream]->h_size;
-         if (theStream[lastStream]->v_size>largy)
-	   largy = theStream[lastStream]->v_size;
-         if (xinfo[i].hints.x > DisplayWidth(xinfo[firstStream].display,
-			       XDefaultScreen(xinfo[firstStream].display)) -80) {
-
-		y += largy + 30;
-		largy = 0;
-		xinfo[i].hints.x = 0;
-         }
-         xinfo[i].hints.y = y;
-         xinfo[i].visual = xinfo[firstStream].visual;
-         xinfo[i].cmap = xinfo[firstStream].cmap;
-         xinfo[i].gc = xinfo[firstStream].gc;
-       }
-       xinfo[i].display = xinfo[0].display;
-       xinfo[i].depth = xinfo[0].depth;
-       xinfo[i].ditherType = xinfo[0].ditherType;
-       InitColorDisplay(name, &xinfo[i]);
+      if (lastStream > -1) {
+        xinfo[i].hints.x =
+          xinfo[lastStream].hints.x+10 + theStream[lastStream]->h_size;
+        if (theStream[lastStream]->v_size>largy)
+          largy = theStream[lastStream]->v_size;
+        if (xinfo[i].hints.x > DisplayWidth(xinfo[firstStream].display,
+            XDefaultScreen(xinfo[firstStream].display)) -80) {
+
+          y += largy + 30;
+          largy = 0;
+          xinfo[i].hints.x = 0;
+        }
+        xinfo[i].hints.y = y;
+        xinfo[i].visual = xinfo[firstStream].visual;
+        xinfo[i].cmap = xinfo[firstStream].cmap;
+        xinfo[i].gc = xinfo[firstStream].gc;
+      }
+      xinfo[i].display = xinfo[0].display;
+      xinfo[i].depth = xinfo[0].depth;
+      xinfo[i].ditherType = xinfo[0].ditherType;
+      InitColorDisplay(name, &xinfo[i]);
     }
+
     curVidStream[i] = theStream[i] = NewVidStream((unsigned int) BUF_LENGTH);
     theStream[i]->ppm_width = ppm_width;
     theStream[i]->ppm_height = ppm_height;
@@ -462,17 +441,18 @@
     theStream[i]->matched_depth = xinfo[i].depth;
     mark = quietFlag;
     quietFlag=1;
+
     if (mpegVidRsrc(0, theStream[i], 1, &xinfo[i])==NULL) {
-       if (doDisplay) {
-         XDestroyWindow(xinfo[i].display, xinfo[i].window);
-       }	
-       /* stream has already been destroyed */
-       curVidStream[i] = theStream[i]=NULL;
-       fprintf(stderr, "Skipping movie %d, \"%s\" - not an MPEG stream\n",
-	  i, inputName[i]);
-       fclose(input[i]);
-       if (i+1 == numInput) numInput--;
-    } else if (firstStream == -1) firstStream=i;
+      if (doDisplay) {
+        XDestroyWindow(xinfo[i].display, xinfo[i].window);
+      }
+      /* stream has already been destroyed */
+      curVidStream[i] = theStream[i]=NULL;
+      fprintf(stderr, "Skipping movie %d, \"%s\" - not an MPEG stream\n",
+              i, inputName[i]);
+      fclose(input[i]);
+      if ((i + 1) == numInput) numInput--;
+    } else if (firstStream == -1) firstStream = i;
     quietFlag = mark;
 
 #ifndef DISABLE_DITHER
@@ -489,7 +469,7 @@
     if (doDisplay && (theStream[i]!=NULL)) {
       ResizeDisplay((unsigned int) theStream[i]->h_size* mult,
                     (unsigned int) theStream[i]->v_size* mult,
-		  &xinfo[i]);
+                    &xinfo[i]);
     }
   }
 
@@ -510,11 +490,9 @@
      if (theStream[i] != NULL) theStream[i]->realTimeStart = ReadSysClock();
   }
 
-
-
   if (ControlShow == CTRLBAR_NONE) {
     while (TRUE) {
-      for (i=0;i < numInput; i++) {
+      for (i = 0; i < numInput; i++) {
         while (theStream[i]->film_has_ended != TRUE) {
           mpegVidRsrc(0, theStream[i], 0, &xinfo[i]);
         }
@@ -528,29 +506,25 @@
         } else if (doDisplay) break;
         else goto done;
       }
-     }
-   }
-  else {
+    }
+  } else {
     ControlLoop(theStream, xinfo, numInput);
   }
 
 done:
-fprintf(stderr, ">>we made it here... cleaning up");
-  mark=0;
-  for (i=0;i < numInput; i++) {
+  fprintf(stderr, ">>we made it here... cleaning up");
+  mark = 0;
+  for (i = 0; i < numInput; i++) {
     DestroyVidStream(theStream[i], &xinfo[i]);
     if ((xinfo[i].display != NULL) && !mark) {
       XCloseDisplay(xinfo[i].display);
-      mark=1;
+      mark = 1;
     }
   }
 
   fprintf(stderr, ">>we made it here... finished playing");
   //delete xinfo[NUMMOVIES];
-//XCloseDisplay(xinfo[i].display);
-  return;
-
-
+  //XCloseDisplay(xinfo[i].display);
 }
 
 
