Index: palm/trunk/SCRIPTS/process_dvr_output
===================================================================
--- palm/trunk/SCRIPTS/process_dvr_output	(revision 262)
+++ palm/trunk/SCRIPTS/process_dvr_output	(revision 336)
@@ -14,4 +14,5 @@
     # Variable declarations + default values
  camera=false
+ create_config_file=false
  create_sequence_output=false
  data_catalog=`pwd`
@@ -19,14 +20,16 @@
  file_identifier=all_streams
  groundplate=false
- palm_run_identifier=""
+ palm_run_identifier="unknown_run"
  topography=false
 
- typeset  -i  i j nstream nscenes
+ typeset  -i  a acceleration=1 k i j nstream nscenes
 
 
     # Read shellscript options
- while  getopts  :d:f:ls option
+ while  getopts  :a:cd:f:ls option
  do
    case  $option  in
+       (a)   acceleration=$OPTARG;;
+       (c)   create_config_file=true;;
        (d)   data_catalog=$OPTARG;;
        (f)   file_identifier=$OPTARG;;
@@ -40,4 +43,23 @@
 
 
+    # Create the config file for the streaming server; do nothing else
+ if [[ $create_config_file = true ]]
+ then
+    cp  ${PALM_BIN}/.dvrserver.config  .
+
+       # Entering the BASEDIR, UID and GID into this file
+    user_id=`id -u`
+    group_id=`id -g`
+
+       # data directory is always the current working directory
+    sed "s/<replace by dvr data directory>/./g" .dvrserver.config > .dvrserver.1
+    sed "s/<replace by user id>/$user_id/g"    .dvrserver.1 > .dvrserver.2
+    sed "s/<replace by group id>/$group_id/g"  .dvrserver.2 > .dvrserver.3
+    mv  .dvrserver.3  .dvrserver.config
+    rm  .dvrserver.1  .dvrserver.2
+    exit
+ fi
+
+
     # Find out the PALM run identifier
  if [[ -f CPU_MEASURES ]]
@@ -45,4 +67,5 @@
     palm_run_identifier=`head -1  CPU_MEASURES`
  fi
+
 
     # Process the streaming server output
@@ -172,14 +195,16 @@
 
        # Change path to the current file identifier
-    sed  "s/DATA_DVR/${file_identifier}_dvr/g"  $dvr_file > tmp_file
+       # Remove path because BASEDIR of streaming server is set to "."
+#    sed  "s/DATA_DVR/${file_identifier}_dvr/g"  $dvr_file > tmp_file
+    sed  "s/DATA_DVR\///g"  $dvr_file > tmp_file
     mv  tmp_file  $dvr_file
 
 
        # If there is a dvr configuration file, set the BASEDIR to the parent
-       # directory of the above given path
+       # directory of the above given path (i.e. ".")
     if [[ -f .dvrserver.config ]]
     then
        old_path=`grep  BASEDIR  .dvrserver.config`
-       sed  "s&${old_path}&BASEDIR=..&g"  .dvrserver.config  >  .dvrserver.config.new
+       sed  "s&${old_path}&BASEDIR=.&g"  .dvrserver.config  >  .dvrserver.config.new
        mv  .dvrserver.config.new  .dvrserver.config
     fi
@@ -326,4 +351,5 @@
  then
 
+    rm -rf  sequence_data
     mkdir  sequence_data
 
@@ -347,15 +373,32 @@
        # Now, merge the data, frame by frame
     (( j = 0 ))
+    (( k = 0 ))
+    (( a = 0 ))
     while (( j < ${frames[1]} ))
     do
 
-       nframe=`printf "%05d" $j`
-
-       (( i = 0 ))
-       while (( i < nstream ))
-       do
-          (( i = i + 1 ))
-          cat  ${streamname[$i]}/$nframe.dvr  >>  sequence_data/$nframe.dvr
-       done
+       rframe=`printf "%05d" $j`
+
+       if (( a == 0 ))
+       then
+
+          wframe=`printf "%05d" $k`
+          (( k = k + 1 ))
+
+          (( i = 0 ))
+          while (( i < nstream ))
+          do
+             (( i = i + 1 ))
+             cat  ${streamname[$i]}/$rframe.dvr  >>  sequence_data/$wframe.dvr
+          done
+
+
+       fi
+
+       (( a = a + 1 ))
+       if (( a == acceleration ))
+       then
+          (( a = 0 ))
+       fi
 
        (( j = j + 1 ))
@@ -368,11 +411,12 @@
     sed  "s/camera.dvr/static_scenes.dvr/g"  tmp1.html  >  tmp2.html
     sed  "s&${streamname[1]}&sequence_data&g"  tmp2.html  >  tmp3.html
+    sed  "s/;0-0/;0-$wframe/g"  tmp3.html  >  tmp4.html
     if [[ "$palm_run_identifier" = "" ]]
     then
-       cp  tmp3.html  ${file_identifier}_sequence.html
+       cp  tmp4.html  ${file_identifier}_sequence.html
     else
-       sed "s&DATA_DVR/sequence_data/\*\*\*\*\*.dvr (DVR 3D Sequence)&DVR 3D sequence generated by $palm_run_identifier&g"  tmp3.html  >  ${file_identifier}_sequence.html
-    fi
-    rm  tmp1.html  tmp2.html  tmp3.html
+       sed "s&DATA_DVR/sequence_data/\*\*\*\*\*.dvr (DVR 3D Sequence)&DVR 3D sequence generated by $palm_run_identifier&g"  tmp4.html  >  ${file_identifier}_sequence.html
+    fi
+    rm  tmp1.html  tmp2.html  tmp3.html  tmp4.html
 
     printf "      data for using sequence mode generated"
