The Filter in between

This guide teaches you how to:

Create the CMakeLists.txt

For this example we create a simple Filter which has a poperty that defines some characters that will be filterd from a stream of charcters. The CMakeLists.txt looks like this:

          
cmake_minimum_required(VERSION 3.18 FATAL_ERROR)
project (CharacterFilterProject)

set (HAPPY_CHARACTER_FILTER happy_character_filter)

if(NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/happy_character_filter.h)
  file(WRITE happy_character_filter.h)
endif()
if(NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/happy_character_filter.cpp)
  file(WRITE happy_character_filter.cpp)
endif()

find_package(ADTF COMPONENTS filtersdk)

# Adds the happy_character_filter project to the Visual Studio solution, which when build
# creates a shared object called happy_character_filter.adtfplugin
adtf_add_filter(${HAPPY_CHARACTER_FILTER} happy_character_filter.h happy_character_filter.cpp)

# Adds the INSTALL project to the Visual Studio solution, which when build
# copies our Filter to the subdirectory given as the second argument into ${CMAKE_INSTALL_PREFIX}
adtf_install_filter(${HAPPY_CHARACTER_FILTER} src/examples/bin)

# Generate a plugindescription for our Filter
adtf_create_plugindescription(
    TARGET ${HAPPY_CHARACTER_FILTER}
    PLUGIN_SUBDIR "src/examples/bin"
    VERSION "0.8.15"
    LICENSE "ADTF"
    SUPPORT_MAIL "support@mycompany.org"
    HOMEPAGE_URL "www.mycompany.org"
)

# Generate a documentation for our Filter
adtf_convert_plugindescription_to_dox(
    TARGET ${HAPPY_CHARACTER_FILTER}
    DIRECTORY ${CMAKE_BINARY_DIR}/src/doxygen/generated
)
          
        

Use the CMake-GUI to configure relevant properties

Switch to the CMake-GUI and follow these steps:

Implement the Filter inside Visual Studio

Build an ADTF Session for our new Filter

Fire up the Configuration Editor

  1. Create a new project
  2. Switch to the processing Filter Graph
  3. Create a Filter Graph that looks like this
    • Drag and drop the Happy Character Remover Filter.
    • Add a data inport using context menu.
    • Add a data outport using context menu.
    • Connect the ports and the Filter to each other, if enabled in your settings, ADTF will automatically add Sample Streams where required (default setting)
    Filter Graph - processing
  4. Switch to the live Filter Graph
  5. Create a Filter Graph that looks like this
    • Drag and drop the Happy Character Receiver Streaming Source.
    • Drag and drop the Happy Character Sender Streaming Sink.
    • Add processing as subgraph using context menu.
    • Connect them to the related ports of the included Subgraph processing, if enabled in your settings, ADTF will automatically add Sample Streams where required (default setting)
    Filter Graph - live
  6. Select the "Happy Character Filter" and edit the "pattern" property. This property defines which chars are filtered by the Filter.
    Filter Graph
  7. Save the project ctrl + s
  8. Switch to the Session Editor tab and make sure, that Filter Graph live is set
  9. Hit F5 to launch the Session
  10. In the command line of the ADTF Control type rl running
    Filter output

Congratulations! Now you know how to Filter samples from a stream by settings a Filter between a Streaming Source and a Streaming Sink.

Where to go next?

Have a look at Properties of ADTF Components to learn how to configure ADTF Components.