snapshot
This commit is contained in:
54
libraries/audio-tools/tests-cmake/codec/hls/CMakeLists.txt
Normal file
54
libraries/audio-tools/tests-cmake/codec/hls/CMakeLists.txt
Normal file
@@ -0,0 +1,54 @@
|
||||
|
||||
cmake_minimum_required(VERSION 3.20)
|
||||
|
||||
# set the project name
|
||||
project(hls)
|
||||
set (CMAKE_CXX_STANDARD 11)
|
||||
set (DCMAKE_CXX_FLAGS "-Werror")
|
||||
|
||||
include(FetchContent)
|
||||
|
||||
# Activate Emulator and Portaudio
|
||||
set(ADD_ARDUINO_EMULATOR ON CACHE BOOL "Add Arduino Emulator Library")
|
||||
set(ADD_PORTAUDIO OFF CACHE BOOL "Add Portaudio Library")
|
||||
|
||||
# Build with arduino-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 with tms
|
||||
FetchContent_Declare(tsdemux GIT_REPOSITORY "https://github.com/pschatzmann/arduino-tsdemux" )
|
||||
FetchContent_GetProperties(tsdemux)
|
||||
if(NOT tsdemux_POPULATED)
|
||||
FetchContent_Populate(tsdemux)
|
||||
add_subdirectory(${tsdemux_SOURCE_DIR} tsdemux)
|
||||
endif()
|
||||
|
||||
FetchContent_Declare(helix GIT_REPOSITORY "https://github.com/pschatzmann/arduino-libhelix.git" GIT_TAG main )
|
||||
FetchContent_GetProperties(helix)
|
||||
if(NOT helix_POPULATED)
|
||||
FetchContent_Populate(helix helix)
|
||||
add_subdirectory(${helix_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}/helix)
|
||||
endif()
|
||||
|
||||
# Download miniaudio.h
|
||||
file(DOWNLOAD https://raw.githubusercontent.com/mackron/miniaudio/master/miniaudio.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/miniaudio.h)
|
||||
|
||||
# build sketch as executable
|
||||
set_source_files_properties(hls.ino PROPERTIES LANGUAGE CXX)
|
||||
add_executable (hls hls.cpp )
|
||||
|
||||
# set preprocessor defines
|
||||
target_compile_definitions(hls PUBLIC -DARDUINO -DIS_DESKTOP -DHELIX_PRINT)
|
||||
|
||||
# access to miniaudio in sketch directory
|
||||
target_include_directories(hls PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
# specify libraries
|
||||
target_link_libraries(hls arduino-audio-tools arduino_emulator tsdemux arduino_helix)
|
||||
|
||||
|
||||
|
||||
|
||||
51
libraries/audio-tools/tests-cmake/codec/hls/hls.cpp
Normal file
51
libraries/audio-tools/tests-cmake/codec/hls/hls.cpp
Normal file
@@ -0,0 +1,51 @@
|
||||
#include "AudioTools.h"
|
||||
#include "AudioTools/AudioCodecs/CodecTSDemux.h"
|
||||
#include "AudioTools/AudioCodecs/CodecADTS.h"
|
||||
#include "AudioTools/AudioCodecs/CodecHelix.h"
|
||||
#include "AudioTools/AudioCodecs/CodecMTS.h"
|
||||
#include "AudioTools/AudioLibs/MiniAudioStream.h"
|
||||
#include "AudioTools/Communication/HLSStream.h"
|
||||
|
||||
AudioInfo info(48000,2,16);
|
||||
HLSStream hls_stream("NA", "NA");
|
||||
// HexDumpOutput hex(Serial);
|
||||
// NullStream null;
|
||||
//CsvOutput<int16_t> out(Serial, 2); // Or use StdOuput
|
||||
MiniAudioStream out;
|
||||
//MTSDecoder mts;
|
||||
//ADTSDecoder adts;
|
||||
AACDecoderHelix aac;
|
||||
MP3DecoderHelix mp3;
|
||||
MultiDecoder multi;
|
||||
//EncodedAudioStream aac_stream(&out, &aac);
|
||||
//EncodedAudioStream adts_stream(&aac_stream, &adts);
|
||||
//EncodedAudioStream mts_stream(&adts_stream, &mts);
|
||||
EncodedAudioStream dec(&out, &mp3);
|
||||
StreamCopy copier(dec, hls_stream);
|
||||
|
||||
// Arduino Setup
|
||||
void setup(void) {
|
||||
//Serial.begin(115200);
|
||||
AudioToolsLogger.begin(Serial, AudioToolsLogLevel::Info);
|
||||
//hls_stream.setLogLevel(AudioLogger::Debug); // hls_stream is quite chatty at Info
|
||||
//adts_stream.setLogLevel(AudioLogger::Debug);
|
||||
//mts_stream.setLogLevel(AudioLogger::Debug);
|
||||
|
||||
aac.setAudioInfoNotifications(false);
|
||||
|
||||
auto cfg = out.defaultConfig(TX_MODE);
|
||||
cfg.copyFrom(info);
|
||||
out.begin();
|
||||
|
||||
//mts_stream.begin();
|
||||
//aac_stream.begin();
|
||||
//adts_stream.begin();
|
||||
|
||||
if (hls_stream.begin("http://audio-edge-cmc51.fra.h.radiomast.io/ref-128k-mp3-stereo/hls.m3u8"))
|
||||
Serial.println("playing...");
|
||||
}
|
||||
|
||||
// Arduino loop
|
||||
void loop() {
|
||||
copier.copy();
|
||||
}
|
||||
Reference in New Issue
Block a user