snapshot
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
cmake_minimum_required(VERSION 3.20)
|
||||
|
||||
# set the project name
|
||||
project(mp4-parser)
|
||||
set (CMAKE_CXX_STANDARD 11)
|
||||
set (DCMAKE_CXX_FLAGS "-Werror")
|
||||
|
||||
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(mp4-parser.ino PROPERTIES LANGUAGE CXX)
|
||||
add_executable (mp4-parser mp4-parser.ino)
|
||||
|
||||
# set preprocessor defines
|
||||
target_compile_definitions(arduino_emulator PUBLIC -DDEFINE_MAIN)
|
||||
target_compile_definitions(mp4-parser PUBLIC -DARDUINO -DIS_DESKTOP)
|
||||
target_compile_options(mp4-parser PRIVATE -Wno-multichar)
|
||||
|
||||
|
||||
# set compile optioins
|
||||
target_compile_options(arduino-audio-tools INTERFACE -Wno-inconsistent-missing-override)
|
||||
|
||||
# specify libraries
|
||||
target_link_libraries(mp4-parser PRIVATE
|
||||
arduino_emulator
|
||||
arduino-audio-tools)
|
||||
@@ -0,0 +1,46 @@
|
||||
/**
|
||||
* @file test-codec-alac.ino
|
||||
* @author Phil Schatzmann
|
||||
* @brief generate sine wave -> encoder -> decoder -> audiokit (i2s)
|
||||
* @version 0.1
|
||||
*
|
||||
* @copyright Copyright (c) 2025
|
||||
*
|
||||
*/
|
||||
#include "AudioTools.h"
|
||||
#include "AudioTools/AudioCodecs/MP4Parser.h"
|
||||
#include "SD.h"
|
||||
|
||||
MP4Parser parser;
|
||||
File file;
|
||||
|
||||
void setup() {
|
||||
Serial.begin(115200);
|
||||
AudioToolsLogger.begin(Serial, AudioToolsLogLevel::Info);
|
||||
|
||||
if (!SD.begin()) {
|
||||
Serial.println("SD Card initialization failed!");
|
||||
return;
|
||||
}
|
||||
|
||||
file = SD.open("/home/pschatzmann/Music/m4a/aac.m4a");
|
||||
if (!file.isOpen()) {
|
||||
Serial.println("Failed to open file!");
|
||||
return;
|
||||
}
|
||||
|
||||
parser.begin();
|
||||
|
||||
Serial.println("MP4 Boxes:");
|
||||
}
|
||||
|
||||
void loop() {
|
||||
char buffer[1024];
|
||||
int to_read = min(sizeof(buffer), parser.availableForWrite());
|
||||
size_t bytesRead = file.readBytes(buffer,to_read);
|
||||
assert(parser.write(buffer, bytesRead)== bytesRead);
|
||||
if (bytesRead == 0) {
|
||||
Serial.println("End of file reached.");
|
||||
exit(0); // Exit the process
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user