snapshot
This commit is contained in:
22
libraries/audio-tools/tests-cmake/rtsp/CMakeLists.txt
Normal file
22
libraries/audio-tools/tests-cmake/rtsp/CMakeLists.txt
Normal file
@@ -0,0 +1,22 @@
|
||||
cmake_minimum_required(VERSION 3.20)
|
||||
|
||||
# set the project name
|
||||
project(rtsp)
|
||||
set (CMAKE_CXX_STANDARD 11)
|
||||
set (DCMAKE_CXX_FLAGS "-Werror")
|
||||
# add_compile_options(-Wstack-usage=1024)
|
||||
|
||||
# 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 sketch as executable
|
||||
add_executable (rtsp rtsp.cpp)
|
||||
|
||||
# set preprocessor defines
|
||||
target_compile_definitions(rtsp PUBLIC -DIS_DESKTOP)
|
||||
|
||||
# specify libraries
|
||||
target_link_libraries(rtsp arduino_emulator arduino-audio-tools)
|
||||
|
||||
42
libraries/audio-tools/tests-cmake/rtsp/rtsp.cpp
Normal file
42
libraries/audio-tools/tests-cmake/rtsp/rtsp.cpp
Normal file
@@ -0,0 +1,42 @@
|
||||
#include "AudioTools.h"
|
||||
#include "AudioTools/Disk/AudioSourceSTD.h"
|
||||
#include "AudioTools/AudioCodecs/MP3Parser.h"
|
||||
#include "AudioTools/Communication/RTSP/RTSPPlatformWiFi.h"
|
||||
#include "AudioTools/Communication/RTSP.h"
|
||||
|
||||
int port = 8554;
|
||||
|
||||
// rtsp
|
||||
MP3ParserEncoder enc; // mp3 packaging
|
||||
RTSPFormatMP3 mp3format(enc); // RTSP mp3
|
||||
MetaDataFilterEncoder filter(enc);
|
||||
RTSPOutput<RTSPPlatformWiFi> rtsp_out(mp3format, filter);
|
||||
AudioSourceSTD source("/home/pschatzmann/Music/Elvis Costello/Best Of/", ".mp3");
|
||||
CopyDecoder dec; // no decoding, just copy
|
||||
AudioPlayer player(source, rtsp_out, dec);
|
||||
RTSPServer<RTSPPlatformWiFi> rtsp(rtsp_out.streamer(), port);
|
||||
|
||||
|
||||
void setup() {
|
||||
Serial.begin(115200);
|
||||
AudioToolsLogger.begin(Serial, AudioToolsLogLevel::Info);
|
||||
|
||||
// delay between mp3 files
|
||||
source.setTimeoutAutoNext(1000);
|
||||
|
||||
// start the player
|
||||
player.begin();
|
||||
|
||||
// Start Output Stream
|
||||
rtsp_out.begin();
|
||||
|
||||
// Start Wifi & rtsp server
|
||||
rtsp.begin();
|
||||
|
||||
}
|
||||
|
||||
void loop() {
|
||||
if (rtsp_out && rtsp) {
|
||||
player.copy();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user