Home | History | Annotate | Download | only in scripts
      1 #!/bin/bash
      2 # Use SED to convert the Oboe API to the AAudio API
      3 
      4 echo "Convert Oboe names to AAudio names"
      5 
      6 echo "Top is ${ANDROID_BUILD_TOP}"
      7 LIBOBOE_DIR=${ANDROID_BUILD_TOP}/frameworks/av/media/liboboe
      8 echo "LIBOBOE_DIR is ${LIBOBOE_DIR}"
      9 OBOESERVICE_DIR=${ANDROID_BUILD_TOP}/frameworks/av/services/oboeservice
     10 echo "OBOESERVICE_DIR is ${OBOESERVICE_DIR}"
     11 OBOETEST_DIR=${ANDROID_BUILD_TOP}/cts/tests/tests/nativemedia/aaudio/src/
     12 echo "OBOETEST_DIR is ${OBOETEST_DIR}"
     13 
     14 function convertPathPattern {
     15     path=$1
     16     pattern=$2
     17     find $path -type f  -name $pattern -exec sed -i -f ${LIBOBOE_DIR}/scripts/oboe_to_aaudio.sed {} \;
     18 }
     19 
     20 function convertPath {
     21     path=$1
     22     convertPathPattern $1 '*.cpp'
     23     convertPathPattern $1 '*.h'
     24     # the mk match does not work!
     25     convertPathPattern $1 '*.mk'
     26     convertPathPattern $1 '*.md'
     27     convertPathPattern $1 '*.bp'
     28 }
     29 
     30 #convertPath ${LIBOBOE_DIR}/examples
     31 #convertPath ${LIBOBOE_DIR}/include
     32 #convertPath ${LIBOBOE_DIR}/src
     33 #convertPath ${LIBOBOE_DIR}/tests
     34 convertPath ${LIBOBOE_DIR}
     35 convertPathPattern ${LIBOBOE_DIR} Android.mk
     36 convertPathPattern ${LIBOBOE_DIR} liboboe.map.txt
     37 
     38 convertPath ${OBOESERVICE_DIR}
     39 convertPathPattern ${OBOESERVICE_DIR} Android.mk
     40 
     41 convertPathPattern ${OBOETEST_DIR} test_aaudio.cpp
     42 
     43 mv ${LIBOBOE_DIR}/include/oboe ${LIBOBOE_DIR}/include/aaudio
     44 mv ${LIBOBOE_DIR}/include/aaudio/OboeAudio.h ${LIBOBOE_DIR}/include/aaudio/AAudio.h
     45 mv ${OBOESERVICE_DIR}/OboeService.h ${OBOESERVICE_DIR}/AAudioServiceDefinitions.h
     46 mv ${LIBOBOE_DIR}/tests/test_oboe_api.cpp ${LIBOBOE_DIR}/tests/test_aaudio_api.cpp
     47 
     48 # Rename files with Oboe in the name.
     49 find -name "*OboeAudioService*.cpp"      | rename -v "s/OboeAudioService/AAudioService/g"
     50 find -name "*OboeAudioService*.h"      | rename -v "s/OboeAudioService/AAudioService/g"
     51 find -name "*Oboe*.cpp"      | rename -v "s/Oboe/AAudio/g"
     52 find -name "*Oboe*.h"        | rename -v "s/Oboe/AAudio/g"
     53