snapshot
This commit is contained in:
28
libraries/audio-tools/tests-cmake/codec/mts/CMakeLists.txt
Normal file
28
libraries/audio-tools/tests-cmake/codec/mts/CMakeLists.txt
Normal file
@@ -0,0 +1,28 @@
|
||||
cmake_minimum_required(VERSION 3.20)
|
||||
|
||||
# set the project name
|
||||
project(mts)
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -g -O0")
|
||||
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -g -O0")
|
||||
|
||||
include(FetchContent)
|
||||
option(BUILD_SHARED_LIBS "Build using shared libraries" OFF)
|
||||
|
||||
|
||||
# provide audio-tools
|
||||
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
|
||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../../.. ${CMAKE_CURRENT_BINARY_DIR}/arduino-audio-tools )
|
||||
endif()
|
||||
|
||||
# build sketch as executable
|
||||
set_source_files_properties(mts.ino PROPERTIES LANGUAGE CXX)
|
||||
add_executable (mts mts.ino)
|
||||
|
||||
# set preprocessor defines
|
||||
target_compile_definitions(mts PUBLIC -DARDUINO -DIS_DESKTOP)
|
||||
|
||||
target_compile_options(arduino-audio-tools INTERFACE -Wno-inconsistent-missing-override)
|
||||
|
||||
# specify libraries
|
||||
target_link_libraries(mts PRIVATE arduino_emulator arduino-audio-tools )
|
||||
|
||||
31
libraries/audio-tools/tests-cmake/codec/mts/mts.ino
Normal file
31
libraries/audio-tools/tests-cmake/codec/mts/mts.ino
Normal file
@@ -0,0 +1,31 @@
|
||||
#include "AudioTools.h"
|
||||
#include "AudioTools/AudioCodecs/CodecMTS.h"
|
||||
|
||||
HexDumpOutput out;
|
||||
MTSDecoder codecMTS;
|
||||
FILE *fp;
|
||||
uint8_t buffer[1024];
|
||||
|
||||
void setup() {
|
||||
AudioToolsLogger.begin(Serial, AudioToolsLogLevel::Info);
|
||||
|
||||
fp = fopen(
|
||||
"/home/pschatzmann/Downloads/tmp/bbc_radio_one-audio=96000-272169555.ts",
|
||||
"rb");
|
||||
codecMTS.setOutput(out);
|
||||
codecMTS.begin();
|
||||
const size_t fileSize = fread(buffer, sizeof(unsigned char), 1024, fp);
|
||||
// Every 188th byte should be 0x47.
|
||||
assert(buffer[0] == 0x47);
|
||||
assert(buffer[188] == 0x47);
|
||||
codecMTS.write(buffer, fileSize);
|
||||
}
|
||||
|
||||
void loop() {
|
||||
const size_t fileSize = fread(buffer, sizeof(unsigned char), 1024, fp);
|
||||
if (fileSize==0) {
|
||||
LOGI("End of File");
|
||||
stop();
|
||||
}
|
||||
codecMTS.write(buffer, fileSize);
|
||||
}
|
||||
Reference in New Issue
Block a user