snapshot
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
cmake_minimum_required(VERSION 3.20)
|
||||
|
||||
# set the project name
|
||||
project(container-avi-movie)
|
||||
set (CMAKE_CXX_STANDARD 11)
|
||||
set (DCMAKE_CXX_FLAGS "-Werror")
|
||||
|
||||
# add_compile_options(-Wstack-usage=1024)
|
||||
include(FetchContent)
|
||||
|
||||
# Add Portaduio for desktop build
|
||||
add_compile_options(-DIS_DESKTOP)
|
||||
FetchContent_Declare(portaudio GIT_REPOSITORY "https://github.com/PortAudio/portaudio.git" GIT_TAG v19.7.0 )
|
||||
FetchContent_GetProperties(portaudio)
|
||||
if(NOT portaudio_POPULATED)
|
||||
FetchContent_Populate(portaudio)
|
||||
add_subdirectory(${portaudio_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}/portaudio)
|
||||
endif()
|
||||
|
||||
# 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()
|
||||
|
||||
# OpenCV
|
||||
find_package( OpenCV REQUIRED )
|
||||
include_directories( ${OpenCV_INCLUDE_DIRS} )
|
||||
|
||||
# build sketch as executable
|
||||
add_executable (container-avi-movie container-avi-movie.cpp)
|
||||
|
||||
# set preprocessor defines
|
||||
target_compile_definitions(container-avi-movie PUBLIC -DUSE_PORTAUDIO -DIS_MIN_DESKTOP)
|
||||
target_include_directories(container-avi-movie PRIVATE "${arduino_emulator_SOURCE_DIR}/ArduinoCore-Linux/libraries/SdFat" )
|
||||
|
||||
# OS/X might need this setting for core audio
|
||||
#target_compile_definitions(portaudio PUBLIC -DPA_USE_COREAUDIO=1)
|
||||
|
||||
# specify libraries
|
||||
target_link_libraries(container-avi-movie portaudio arduino-audio-tools ${OpenCV_LIBS})
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
/**
|
||||
* @file container-avi-movie.cpp
|
||||
* @author Phil Schatzmann
|
||||
* @brief Play AVI test movie downloaded from https://archive.org/embed/Test_Avi
|
||||
* To build execute the following steps
|
||||
* - mkdir build
|
||||
* - cd build
|
||||
* - cmake ..
|
||||
* - make
|
||||
* @version 0.1
|
||||
* @date 2022-04-30
|
||||
*
|
||||
* @copyright Copyright (c) 2022
|
||||
*
|
||||
*/
|
||||
|
||||
#include "AudioTools.h"
|
||||
#include "AudioTools/AudioCodecs/ContainerAVI.h"
|
||||
#include "AudioTools/AudioLibs/Desktop/File.h"
|
||||
#include "AudioTools/AudioLibs/PortAudioStream.h"
|
||||
#include "Video/JpegOpenCV.h"
|
||||
|
||||
PortAudioStream out; // Output of sound on desktop
|
||||
JpegOpenCV jpegDisplay;
|
||||
AVIDecoder codec(new DecoderL8(), &jpegDisplay);
|
||||
EncodedAudioOutput avi(&out, &codec);
|
||||
File file;
|
||||
StreamCopy copier(avi, file);
|
||||
VideoAudioBufferedSync videoSync(10*1024, -20);
|
||||
|
||||
|
||||
void setup() {
|
||||
AudioToolsLogger.begin(Serial, AudioToolsLogLevel::Info);
|
||||
file.open("/data/resources/test1.avi",FILE_READ);
|
||||
codec.setOutputVideoStream(jpegDisplay);
|
||||
codec.setVideoAudioSync(&videoSync);
|
||||
//codec.setMute(true);
|
||||
}
|
||||
|
||||
void loop() {
|
||||
if(!copier.copy()){
|
||||
stop();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user