Ignore:
Timestamp:
Mar 17, 2009 4:52:51 AM (12 years ago)
Author:
raasch
Message:

further changes concerning dvr output

File:
1 edited

Legend:

Unmodified
Added
Removed
  • palm/trunk/SCRIPTS/process_dvr_output

    r260 r261  
    33# $Id$
    44
     5     # This script determines the number of streams opened by the dvr software
     6     # and creates one single dvrs- and html-file which allow the dvr-plugin
     7     # to display all streams in one sequence.
     8
    59     # Last changes:
    610     # 16/03/09 - Siggi - Generating the first version
     
    1014    # variable declarations + default values
    1115 camera=false
     16 create_sequence_output=false
     17 data_catalog=`pwd`
     18 file_identifier=all_streams
    1219 groundplate=false
    1320 topography=false
    1421
    15  typeset  -i  i nstream nscenes
     22 typeset  -i  i j nstream nscenes
    1623
    1724
    1825    # read shellscript options
    19  while  getopts  :d:f: option
     26 while  getopts  :d:f:s option
    2027 do
    2128   case  $option  in
    2229       (d)   data_catalog=$OPTARG;;
    2330       (f)   file_identifier=$OPTARG;;
     31       (s)   create_sequence_output=true;;
    2432       (\?)  printf "\n  +++ unknown option $OPTARG \n"
    2533             printf "\n      allowed option are -d and -f \n"
     
    2937
    3038
     39    # change to the given directory
     40 cd $data_catalog
     41
     42
    3143    # find out the number of streams
    3244 (( i = 0 ))
     
    6476 nscenes=$nstream
    6577
    66  echo "*** number of detected streams = $i"
    67 
    68  (( i = 0 ))
    69  while (( i < nstream ))
    70  do
    71 
    72     (( i = i + 1 ))
    73     echo "*** streamname: \"${streamname[$i]}\" "
    74     echo "    adr = \"${adr[$i]}\" "
    75     echo "    maxbytes = \"${maxbytes[$i]}\" "
    76     echo "    frames = \"${frames[$i]}\" "
    77 
    78  done
    7978
    8079    # Check, if there are files containing the camera data, the ground plate
     
    106105
    107106    # start with writing the dvrs file for the combined streams
    108  dvr_file=${file_identifier}.dvrs
     107 dvr_file=${file_identifier}_streaming.dvrs
    109108
    110109 echo  "SCENES=$nscenes"  >  $dvr_file
     
    159158
    160159
    161     # create the html file for the combined scenes
     160    # change path to the current file identifier
     161 sed  "s/DATA_DVR/${file_identifier}_dvr/g"  $dvr_file > tmp_file
     162 mv  tmp_file  $dvr_file
     163
     164
     165    # if there is a dvr configuration file, set the BASEDIR to the parent
     166    # directory of the above given path
     167 if [[ -f .dvrserver.config ]]
     168 then
     169    old_path=`grep  BASEDIR  .dvrserver.config`
     170    sed  "s&${old_path}&BASEDIR=..&g"  .dvrserver.config  >  .dvrserver.config.new
     171    mv  .dvrserver.config.new  .dvrserver.config
     172 fi
     173
     174
     175    # create the html file for the combined streames
    162176 cp  01_*-ge.html  tmp.html
    163177 replace=$(echo `grep src= tmp.html`)
    164  sed "s&${replace}&src=\"${file_identifier}.dvrs\"&g" tmp.html > ${file_identifier}.html
     178 sed "s&${replace}&src=\"${file_identifier}_streaming.dvrs\"&g" tmp.html > ${file_identifier}_streaming.html
    165179 rm tmp.html
     180
     181
     182    # informative messages
     183 printf "\n\n  *** processing local dvr stream output:"
     184 printf "\n      number of detected streams = $nstream"
     185 printf "\n      stream names:"
     186
     187 (( i = 0 ))
     188 while (( i < nstream ))
     189 do
     190
     191    (( i = i + 1 ))
     192    printf " ${streamname[$i]}"
     193
     194 done
     195 printf "\n"
     196
     197
     198    # create output for viewing dvr data in sequence mode
     199 if [[ $create_sequence_output = true ]]
     200 then
     201
     202    mkdir  sequence_data
     203
     204       # first, merge static scenes into one file
     205    if [[ $camera = true ]]
     206    then
     207       cat  ${streamname[1]}/camera.dvr  >>  sequence_data/static_scenes.dvr
     208    fi
     209
     210    if [[ $groundplate = true ]]
     211    then
     212       cat  ${streamname[1]}/groundplate.dvr  >>  sequence_data/static_scenes.dvr
     213    fi
     214
     215    if [[ $topography = true ]]
     216    then
     217       cat  ${streamname[1]}/topography.dvr  >>  sequence_data/static_scenes.dvr
     218    fi
     219
     220
     221       # now, merge the data, frame by frame
     222    (( j = 0 ))
     223    while (( j < ${frames[1]} ))
     224    do
     225
     226       nframe=`printf "%05d" $j`
     227
     228       (( i = 0 ))
     229       while (( i < nstream ))
     230       do
     231          (( i = i + 1 ))
     232          cat  ${streamname[$i]}/$nframe.dvr  >>  sequence_data/$nframe.dvr
     233       done
     234
     235       (( j = j + 1 ))
     236
     237    done
     238
     239
     240       # create the html file to be used for the sequence mode
     241    cp  ${streamname[1]}.html  tmp1.html
     242    sed  "s/camera.dvr/static_scenes.dvr/g"  tmp1.html  >  tmp2.html
     243    sed  "s&${streamname[1]}&sequence_data&g"  tmp2.html  >  ${file_identifier}_sequence.html
     244    rm  tmp1.html  tmp2.html
     245
     246    printf "      data for using sequence mode generated"
     247
     248 fi
     249
     250
     251
     252    # change back to directory from where script has been called
     253 cd - > /dev/null
Note: See TracChangeset for help on using the changeset viewer.