├── .gitignore ├── .gitmodules ├── CMakeLists.txt ├── LICENSE ├── Makefile ├── backtrace.js ├── bluetooth-mem-gotchas.txt ├── components ├── bt-keyboard │ └── component.mk ├── cspot │ ├── CMakeLists.txt │ ├── bell-utils │ │ ├── BellLogger.cpp │ │ ├── BellUtils.cpp │ │ ├── Crypto.cpp │ │ ├── NanoPBExtensions.cpp │ │ ├── NanoPBHelper.cpp │ │ ├── aes.c │ │ └── include │ │ │ ├── BellLogger.h │ │ │ ├── BellUtils.h │ │ │ ├── Crypto.h │ │ │ ├── NanoPBExtensions.h │ │ │ ├── NanoPBHelper.h │ │ │ ├── Queue.h │ │ │ ├── TimeDefs.h │ │ │ └── aes.h │ ├── component.mk │ ├── protobuf │ │ ├── authentication.options │ │ ├── authentication.proto │ │ ├── keyexchange.options │ │ ├── keyexchange.proto │ │ ├── login5.options │ │ ├── login5.proto │ │ ├── mercury.options │ │ ├── mercury.proto │ │ ├── metadata.options │ │ ├── metadata.proto │ │ ├── spirc.options │ │ └── spirc.proto │ └── src │ │ ├── AccessKeyFetcher.cpp │ │ ├── AccessKeyFetcher.h │ │ ├── ApResolve.cpp │ │ ├── ApResolve.h │ │ ├── AuthChallenges.cpp │ │ ├── AuthChallenges.h │ │ ├── CSpotContext.h │ │ ├── ConstantParameters.h │ │ ├── CspotAssert.h │ │ ├── Logger.h │ │ ├── LoginBlob.cpp │ │ ├── LoginBlob.h │ │ ├── MercurySession.cpp │ │ ├── MercurySession.h │ │ ├── Packet.h │ │ ├── PlainConnection.cpp │ │ ├── PlainConnection.h │ │ ├── PlaybackState.cpp │ │ ├── PlaybackState.h │ │ ├── Session.cpp │ │ ├── Session.h │ │ ├── Shannon.cpp │ │ ├── Shannon.h │ │ ├── ShannonConnection.cpp │ │ ├── ShannonConnection.h │ │ ├── SpircHandler.cpp │ │ ├── SpircHandler.h │ │ ├── TimeProvider.cpp │ │ ├── TimeProvider.h │ │ ├── TrackQueue.cpp │ │ ├── TrackQueue.h │ │ ├── TrackReference.cpp │ │ ├── TrackReference.h │ │ ├── Utils.cpp │ │ └── Utils.h ├── equalizer │ ├── CMakeLists.txt │ ├── component.mk │ ├── esp_equalizer.h │ └── libeq.a ├── httpLib ├── json ├── libFLAC │ ├── CMakeLists.txt │ ├── bitmath.c │ ├── bitreader.c │ ├── bitwriter.c │ ├── component.mk │ ├── config.h │ ├── cpu.c │ ├── crc.c │ ├── deduplication │ │ ├── lpc_compute_autocorrelation_intrin.c │ │ ├── lpc_compute_autocorrelation_intrin_neon.c │ │ └── lpc_compute_autocorrelation_intrin_sse2.c │ ├── fixed.c │ ├── float.c │ ├── format.c │ ├── include │ │ ├── FLAC │ │ │ ├── Makefile.am │ │ │ ├── all.h │ │ │ ├── assert.h │ │ │ ├── callback.h │ │ │ ├── export.h │ │ │ ├── format.h │ │ │ ├── metadata.h │ │ │ ├── ordinals.h │ │ │ ├── stream_decoder.h │ │ │ └── stream_encoder.h │ │ ├── Makefile.am │ │ ├── private │ │ │ ├── Makefile.am │ │ │ ├── all.h │ │ │ ├── bitmath.h │ │ │ ├── bitreader.h │ │ │ ├── bitwriter.h │ │ │ ├── cpu.h │ │ │ ├── crc.h │ │ │ ├── fixed.h │ │ │ ├── float.h │ │ │ ├── format.h │ │ │ ├── lpc.h │ │ │ ├── macros.h │ │ │ ├── md5.h │ │ │ ├── memory.h │ │ │ ├── metadata.h │ │ │ ├── ogg_decoder_aspect.h │ │ │ ├── ogg_encoder_aspect.h │ │ │ ├── ogg_helper.h │ │ │ ├── ogg_mapping.h │ │ │ ├── stream_encoder.h │ │ │ ├── stream_encoder_framing.h │ │ │ └── window.h │ │ ├── protected │ │ │ ├── Makefile.am │ │ │ ├── all.h │ │ │ ├── stream_decoder.h │ │ │ └── stream_encoder.h │ │ └── share │ │ │ ├── Makefile.am │ │ │ ├── alloc.h │ │ │ ├── compat.h │ │ │ ├── endswap.h │ │ │ ├── getopt.h │ │ │ ├── grabbag.h │ │ │ ├── grabbag │ │ │ ├── Makefile.am │ │ │ ├── cuesheet.h │ │ │ ├── file.h │ │ │ ├── picture.h │ │ │ ├── replaygain.h │ │ │ └── seektable.h │ │ │ ├── macros.h │ │ │ ├── private.h │ │ │ ├── replaygain_analysis.h │ │ │ ├── replaygain_synthesis.h │ │ │ ├── safe_str.h │ │ │ ├── utf8.h │ │ │ └── win_utf8_io.h │ ├── lpc.c │ ├── md5.c │ ├── memory.c │ ├── metadata_iterators.c │ ├── metadata_object.c │ ├── ogg_decoder_aspect.c │ ├── ogg_encoder_aspect.c │ ├── ogg_helper.c │ ├── ogg_mapping.c │ ├── stream_decoder.c │ ├── stream_encoder.c │ ├── stream_encoder_framing.c │ └── window.c ├── libhelix-aac │ ├── CMakeLists.txt │ ├── aaccommon.h │ ├── aacdec.c │ ├── aacdec.h │ ├── aactabs.c │ ├── assembly.h │ ├── bitstream.c │ ├── bitstream.h │ ├── buffers.c │ ├── coder.h │ ├── component.mk │ ├── dct4.c │ ├── decelmnt.c │ ├── dequant.c │ ├── fft.c │ ├── filefmt.c │ ├── huffman.c │ ├── hufftabs.c │ ├── imdct.c │ ├── noiseless.c │ ├── pns.c │ ├── readme.txt │ ├── sbr.c │ ├── sbr.h │ ├── sbrfft.c │ ├── sbrfreq.c │ ├── sbrhfadj.c │ ├── sbrhfgen.c │ ├── sbrhuff.c │ ├── sbrimdct.c │ ├── sbrmath.c │ ├── sbrqmf.c │ ├── sbrside.c │ ├── sbrtabs.c │ ├── statname.h │ ├── stproc.c │ ├── tns.c │ └── trigtabs.c ├── libmad │ ├── CHANGES │ ├── CMakeLists.txt │ ├── COPYING │ ├── COPYRIGHT │ ├── CREDITS │ ├── D.dat │ ├── INSTALL │ ├── Makefile.in │ ├── README │ ├── TODO │ ├── VERSION │ ├── aclocal.m4 │ ├── bit.c │ ├── bit.h │ ├── component.mk │ ├── config.guess │ ├── config.h │ ├── config.h.in │ ├── config.sub │ ├── configure │ ├── configure.ac │ ├── decoder.c │ ├── decoder.h │ ├── depcomp │ ├── fixed.c │ ├── fixed.h │ ├── frame.c │ ├── frame.h │ ├── global.h │ ├── huffman.c │ ├── huffman.h │ ├── imdct_s.dat │ ├── install-sh │ ├── layer12.c │ ├── layer12.h │ ├── layer3.c │ ├── layer3.h │ ├── libmad.list.in │ ├── ltmain.sh │ ├── mad.h │ ├── mad.h.sed │ ├── missing │ ├── mkinstalldirs │ ├── qc_table.dat │ ├── rq_table.dat │ ├── sf_table.dat │ ├── stream.c │ ├── stream.h │ ├── synth.c │ ├── synth.h │ ├── timer.c │ ├── timer.h │ ├── version.c │ └── version.h ├── libogg │ ├── CMakeLists.txt │ ├── Makefile.am │ ├── Makefile.in │ ├── bitwise.c │ ├── component.mk │ ├── crctable.h │ ├── framing.c │ └── include │ │ ├── Makefile.am │ │ ├── Makefile.in │ │ └── ogg │ │ ├── Makefile.am │ │ ├── Makefile.in │ │ ├── config_types.h │ │ ├── config_types.h.in │ │ ├── ogg.h │ │ └── os_types.h ├── mySystem ├── myeq │ ├── CMakeLists.txt │ ├── biquad.S │ ├── biquad.hpp │ ├── component.mk │ ├── equalizer.cpp │ ├── equalizer.hpp │ └── test │ │ ├── eqTest.cpp │ │ └── eqTestPipe.cpp ├── st7735 ├── tinyxml │ ├── CMakeLists.txt │ ├── component.mk │ ├── tinyxml2.cpp │ └── tinyxml2.h └── tremor │ ├── CHANGELOG │ ├── CMakeLists.txt │ ├── COPYING │ ├── Makefile.am │ ├── README │ ├── Version_script.in │ ├── asm_arm.h │ ├── autogen.sh │ ├── backends.h │ ├── block.c │ ├── block.h │ ├── codebook.c │ ├── codebook.h │ ├── codec_internal.h │ ├── component.mk │ ├── config_types.h │ ├── configure.in │ ├── debian │ ├── Makefile.am │ ├── changelog │ ├── control │ ├── copyright │ ├── libvorbisidec-dev.install │ ├── libvorbisidec1.install │ └── rules │ ├── doc │ ├── OggVorbis_File.html │ ├── build.html │ ├── callbacks.html │ ├── datastructures.html │ ├── decoding.html │ ├── diff.html │ ├── example.html │ ├── fileinfo.html │ ├── index.html │ ├── initialization.html │ ├── ov_bitrate.html │ ├── ov_bitrate_instant.html │ ├── ov_callbacks.html │ ├── ov_clear.html │ ├── ov_comment.html │ ├── ov_info.html │ ├── ov_open.html │ ├── ov_open_callbacks.html │ ├── ov_pcm_seek.html │ ├── ov_pcm_seek_page.html │ ├── ov_pcm_tell.html │ ├── ov_pcm_total.html │ ├── ov_raw_seek.html │ ├── ov_raw_tell.html │ ├── ov_raw_total.html │ ├── ov_read.html │ ├── ov_seekable.html │ ├── ov_serialnumber.html │ ├── ov_streams.html │ ├── ov_test.html │ ├── ov_test_callbacks.html │ ├── ov_test_open.html │ ├── ov_time_seek.html │ ├── ov_time_seek_page.html │ ├── ov_time_tell.html │ ├── ov_time_total.html │ ├── overview.html │ ├── reference.html │ ├── return.html │ ├── seeking.html │ ├── style.css │ ├── threads.html │ ├── vorbis_comment.html │ └── vorbis_info.html │ ├── floor0.c │ ├── floor1.c │ ├── info.c │ ├── iseeking_example.c │ ├── ivorbiscodec.h │ ├── ivorbisfile.h │ ├── ivorbisfile_example.c │ ├── lsp_lookup.h │ ├── mapping0.c │ ├── mdct.c │ ├── mdct.h │ ├── mdct_lookup.h │ ├── misc.h │ ├── registry.c │ ├── registry.h │ ├── res012.c │ ├── sharedbook.c │ ├── synthesis.c │ ├── vorbisfile.c │ ├── vorbisidec.pc.in │ ├── win32 │ ├── VS2005 │ │ ├── libogg.vsprops │ │ └── libtremor │ │ │ └── libtremor.vcproj │ └── VS2008 │ │ ├── libogg.vsprops │ │ └── libtremor │ │ └── libtremor.vcproj │ ├── window.c │ ├── window.h │ └── window_lookup.h ├── dlna ├── avtrans.xml ├── connmgr.xml ├── deviceDesc.xml └── rendctl.xml ├── esp-host.sh ├── esplink-flash.sh ├── i2s-dma-psram-4.4.8.patch ├── idf-4.4.2.patch ├── iram-4.4.8.patch ├── log.sh ├── madTest.cpp ├── main ├── CMakeLists.txt ├── a2dpInputNode.cpp ├── a2dpInputNode.hpp ├── audioNode.cpp ├── audioNode.hpp ├── audioPlayer.cpp ├── audioPlayer.hpp ├── autoString.hpp ├── board.h ├── btRemote.cpp ├── btRemote.hpp ├── component.mk ├── decoderAac.cpp ├── decoderAac.hpp ├── decoderFlac.cpp ├── decoderFlac.hpp ├── decoderMp3.cpp ├── decoderMp3.hpp ├── decoderNode.cpp ├── decoderNode.hpp ├── decoderVorbis.cpp ├── decoderVorbis.hpp ├── decoderWav.cpp ├── decoderWav.hpp ├── detectorOgg.hpp ├── dlna-parse.cpp ├── dlna-parse.hpp ├── dlna.cpp ├── dlna.hpp ├── eqCores.cpp ├── eqCores.hpp ├── equalizerNode.cpp ├── equalizerNode.hpp ├── exceptions.hpp ├── font_Camingo22.cpp ├── font_Camingo32.cpp ├── font_CamingoBold43.cpp ├── font_Icons22.cpp ├── httpNode.cpp ├── httpNode.hpp ├── i2sSinkNode.cpp ├── i2sSinkNode.hpp ├── icyParser.cpp ├── icyParser.hpp ├── netplayer.cpp ├── playlist.cpp ├── playlist.hpp ├── recorder.cpp ├── recorder.hpp ├── speedProbe.hpp ├── spotify.cpp ├── spotify.hpp ├── stationList.cpp ├── stationList.hpp ├── streamDefs.cpp ├── streamDefs.hpp ├── streamPackets.hpp ├── streamRingQueue.hpp ├── volume.hpp ├── vorbisHighLevel.hpp ├── vuDisplay.cpp └── vuDisplay.hpp ├── ota.sh ├── partitions.csv ├── partoffset.py ├── recovery ├── CMakeLists.txt ├── components │ ├── httpLib │ ├── mySystem │ └── st7735 ├── main │ ├── CMakeLists.txt │ ├── font_Camingo22.cpp │ ├── font_Camingo32.cpp │ ├── main.cpp │ └── rtcSharedMem.hpp ├── partitions.csv ├── sdkconfig └── sdkconfig-4.4.8 ├── sdkconfig ├── staexport.sh ├── staimport.sh ├── wup.sh └── www ├── eq-afc.html ├── eq.html ├── fm.html └── index.html /.gitignore: -------------------------------------------------------------------------------- 1 | build 2 | managed_components 3 | recovery/build 4 | recovery/managed_components 5 | 6 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "esp32-mylibs"] 2 | path = esp32-mylibs 3 | url = git@github.com:alxvasilev/esp32-mylibs.git 4 | [submodule "components/cspot/nanopb"] 5 | path = components/cspot/nanopb 6 | url = https://github.com/nanopb/nanopb.git 7 | -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # The following lines of boilerplate have to be in your project's 2 | # CMakeLists in this exact order for cmake to work correctly 3 | cmake_minimum_required(VERSION 3.16) 4 | 5 | include($ENV{IDF_PATH}/tools/cmake/project.cmake) 6 | 7 | project(netplayer) 8 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | PROJECT_NAME := netplayer 2 | 3 | include $(IDF_PATH)/make/project.mk 4 | 5 | # SPIFFS_IMAGE_FLASH_IN_PROJECT := 1 6 | # $(eval $(call spiffs_create_partition_image,storage,spiffs)) 7 | -------------------------------------------------------------------------------- /backtrace.js: -------------------------------------------------------------------------------- 1 | #!/bin/env node 2 | var spawn = require('child_process').execFileSync; 3 | var fs = require('fs'); 4 | 5 | if (process.argv.length < 3) { 6 | console.log(`Usage: node ${process.argv[1]} ....`); 7 | process.exit(1); 8 | } 9 | let addresses = []; 10 | for (let i = 2; i < process.argv.length; i++) { 11 | let str = process.argv[i]; 12 | let addrs = str.split(" "); 13 | for (addr of addrs) { 14 | if (!addr.startsWith("0x")) { 15 | if (addr.toLowerCase().startsWith("backtrace") && !addresses.length) { 16 | continue; 17 | } 18 | console.error(`Invalid address "${addr}"`); 19 | process.exit(1); 20 | } 21 | addresses.push(addr); 22 | } 23 | } 24 | let elfs = fs.readdirSync('.').filter(fn => fn.endsWith('.elf')); 25 | if (elfs.length < 1) { 26 | console.error("No .elf file found in current directory"); 27 | process.exit(1); 28 | } 29 | if (elfs.length > 1) { 30 | console.error("More than one .elf files found in current directory:", JSON.stringify(elfs)); 31 | process.exit(1); 32 | } 33 | let elfFile = elfs[0]; 34 | console.log(`================ Backtrace (./${elfFile}) ================`); 35 | for (let addr of addresses) { 36 | spawn("xtensa-esp32-elf-addr2line", ["-pfiaC", "-e", "./" + elfFile, addr], {'stdio': 'inherit'}); 37 | } 38 | -------------------------------------------------------------------------------- /bluetooth-mem-gotchas.txt: -------------------------------------------------------------------------------- 1 | esp_bt_mem_release(mode) releases the following RAM areas, adding the to the allocator: 2 | - Controller memory (~54K) in SRAM2: 4 areas, freed by esp_bt_controller_rom_mem_release(): 3 | [0x3ffae6e0] - [0x3ffaff10] (6192 bytes) 4 | [0x3ffb0000] - [0x3ffb7cd8] (31960 bytes) 5 | [0x3ffb8000] - [0x3ffb9a20] (6688 bytes) 6 | [0x3ffbdb28] - [0x3ffbdb5c] (52 bytes) 7 | - The BSS and DATA sections of two libs, only if mode is ESP_BT_MODE_BTDM: 8 | - the controller lib - libbtdm_app.a, which is a firmware BLOB, whose sections are described in /components/bt/linker_rw_bt_controller.lf 9 | - libbt.a, described in /components/bt/linker_common.lf 10 | - The sizes of these sections, dumped from esp_bt_mem_release() are: 11 | bt_bss: 2636 12 | cont_bss: 464 13 | bt_data: 4560 14 | cont_data: 32 15 | 16 | esp_bt_controller_disable() calls the function btdm_controller_disable() of the btdm_app.a BLOB 17 | -------------------------------------------------------------------------------- /components/bt-keyboard/component.mk: -------------------------------------------------------------------------------- 1 | # 2 | # Main Makefile. This is basically the same as a component makefile. 3 | # 4 | # This Makefile should, at the very least, just include $(SDK_PATH)/make/component_common.mk. By default, 5 | # this will take the sources in the src/ directory, compile them and link them into 6 | # lib(subdirectory_name).a in the build directory. This behaviour is entirely configurable, 7 | # please read the ESP-IDF documents if you need to do this. 8 | # 9 | 10 | COMPONENT_SRCDIRS := . 11 | COMPONENT_ADD_INCLUDEDIRS += . 12 | 13 | -------------------------------------------------------------------------------- /components/cspot/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | message(STATUS srcdir=${CMAKE_CURRENT_SOURCE_DIR}) 2 | message(STATUS bindir=${CMAKE_CURRENT_BINARY_DIR}) 3 | idf_component_register( 4 | SRC_DIRS src bell-utils nanopb 5 | INCLUDE_DIRS src bell-utils/include nanopb ${CMAKE_CURRENT_BINARY_DIR} 6 | # ADDITIONAL_CLEAN_FILES ${CMAKE_CURRENT_BINARY_DIR}/protobuf/*.o 7 | REQUIRES mbedtls pthread json httpLib 8 | ) 9 | target_compile_options(${COMPONENT_LIB} PRIVATE -fexceptions) 10 | target_compile_definitions(${COMPONENT_LIB} PUBLIC -D BELL_ONLY_CJSON=1 -DPB_ENABLE_MALLOC=1) 11 | 12 | file(GLOB PROTO_FILES protobuf/*.proto) 13 | set(PB_SRCS) 14 | set(PB_OBJS) 15 | foreach(_path ${PROTO_FILES}) 16 | set(_stem) 17 | get_filename_component(_stem "${_path}" NAME_WLE) 18 | list(APPEND PB_SRCS "${CMAKE_CURRENT_BINARY_DIR}/protobuf/${_stem}.pb.c") 19 | list(APPEND PB_OBJS "${CMAKE_CURRENT_BINARY_DIR}/protobuf/${_stem}.pb.c.o") 20 | endforeach() 21 | 22 | target_sources(${COMPONENT_LIB} PRIVATE ${PB_SRCS}) 23 | 24 | add_custom_command( 25 | COMMAND mkdir -p ${CMAKE_CURRENT_BINARY_DIR}/protobuf 26 | OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/protobuf 27 | ) 28 | add_custom_command( 29 | COMMAND /usr/bin/python ${CMAKE_CURRENT_SOURCE_DIR}/nanopb/generator/nanopb_generator.py -I ${CMAKE_CURRENT_SOURCE_DIR}/protobuf -D ${CMAKE_CURRENT_BINARY_DIR}/protobuf ${PROTO_FILES} 30 | DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/protobuf 31 | OUTPUT ${PB_SRCS} 32 | ) 33 | -------------------------------------------------------------------------------- /components/cspot/bell-utils/BellLogger.cpp: -------------------------------------------------------------------------------- 1 | #include "BellLogger.h" 2 | 3 | bell::AbstractLogger* bell::bellGlobalLogger; 4 | 5 | void bell::setDefaultLogger() { 6 | bell::bellGlobalLogger = new bell::BellLogger(); 7 | } 8 | 9 | void bell::enableSubmoduleLogging() { 10 | bell::bellGlobalLogger->enableSubmodule = true; 11 | } 12 | 13 | void bell::enableTimestampLogging(bool local) { 14 | bell::bellGlobalLogger->enableTimestamp = true; 15 | bell::bellGlobalLogger->shortTime = local; 16 | } 17 | -------------------------------------------------------------------------------- /components/cspot/bell-utils/BellUtils.cpp: -------------------------------------------------------------------------------- 1 | #include "BellUtils.h" 2 | 3 | #include // for free 4 | #include // for mt19937, uniform_int_distribution, random_device 5 | #ifdef ESP_PLATFORM 6 | #include "esp_system.h" 7 | #if __has_include("esp_mac.h") 8 | #include "esp_mac.h" 9 | #endif 10 | #endif 11 | 12 | std::string bell::generateRandomUUID() { 13 | static std::random_device dev; 14 | static std::mt19937 rng(dev()); 15 | 16 | std::uniform_int_distribution dist(0, 15); 17 | 18 | const char* v = "0123456789abcdef"; 19 | const bool dash[] = {0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0}; 20 | 21 | std::string res; 22 | for (int i = 0; i < 16; i++) { 23 | if (dash[i]) 24 | res += "-"; 25 | res += v[dist(rng)]; 26 | res += v[dist(rng)]; 27 | } 28 | return res; 29 | } 30 | 31 | std::string bell::getMacAddress() { 32 | #ifdef ESP_PLATFORM 33 | 34 | uint8_t mac[6]; 35 | esp_read_mac(mac, ESP_MAC_WIFI_STA); 36 | char macStr[18]; 37 | sprintf(macStr, "%02x:%02x:%02x:%02x:%02x:%02x", mac[0], mac[1], mac[2], 38 | mac[3], mac[4], mac[5]); 39 | return std::string(macStr); 40 | #endif 41 | return "00:00:00:00:00:00"; 42 | } 43 | 44 | void bell::freeAndNull(void*& ptr) { 45 | free(ptr); 46 | ptr = nullptr; 47 | } 48 | -------------------------------------------------------------------------------- /components/cspot/bell-utils/NanoPBExtensions.cpp: -------------------------------------------------------------------------------- 1 | #include "NanoPBExtensions.h" 2 | 3 | #include // for optional 4 | #include // for string 5 | #include // for vector 6 | 7 | #include 8 | #include 9 | 10 | bool bell::nanopb::encodeString(pb_ostream_t* stream, const pb_field_t* field, 11 | void* const* arg) { 12 | auto& str = *static_cast(*arg); 13 | 14 | if (str.size() > 0) { 15 | if (!pb_encode_tag_for_field(stream, field)) { 16 | return false; 17 | } 18 | 19 | if (!pb_encode_string(stream, (uint8_t*)str.c_str(), str.size())) { 20 | return false; 21 | } 22 | } 23 | 24 | return true; 25 | } 26 | 27 | bool bell::nanopb::encodeBoolean(pb_ostream_t* stream, const pb_field_t* field, 28 | void* const* arg) { 29 | auto& boolean = *static_cast*>(*arg); 30 | 31 | if (boolean.has_value()) { 32 | if (!pb_encode_tag_for_field(stream, field)) { 33 | return false; 34 | } 35 | 36 | if (!pb_encode_varint(stream, boolean.value())) { 37 | return false; 38 | } 39 | } 40 | 41 | return true; 42 | } 43 | 44 | bool bell::nanopb::encodeVector(pb_ostream_t* stream, const pb_field_t* field, 45 | void* const* arg) { 46 | auto& vector = *static_cast*>(*arg); 47 | 48 | if (vector.size() > 0) { 49 | if (!pb_encode_tag_for_field(stream, field)) { 50 | return false; 51 | } 52 | 53 | if (!pb_encode_string(stream, vector.data(), vector.size())) { 54 | return false; 55 | } 56 | } 57 | 58 | return true; 59 | } -------------------------------------------------------------------------------- /components/cspot/bell-utils/include/NanoPBExtensions.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | /// Set of helper methods that simplify nanopb usage in C++. 6 | namespace bell::nanopb { 7 | bool encodeString(pb_ostream_t* stream, const pb_field_t* field, 8 | void* const* arg); 9 | 10 | bool encodeVector(pb_ostream_t* stream, const pb_field_t* field, 11 | void* const* arg); 12 | 13 | bool encodeBoolean(pb_ostream_t* stream, const pb_field_t* field, 14 | void* const* arg); 15 | } // namespace bell::nanopb -------------------------------------------------------------------------------- /components/cspot/bell-utils/include/NanoPBHelper.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include // for uint8_t 4 | #include // for printf 5 | #include // for string 6 | #include // for vector 7 | 8 | #include "pb.h" // for pb_msgdesc_t, pb_bytes_array_t, PB_GET_ERROR 9 | #include "pb_decode.h" // for pb_istream_from_buffer, pb_decode, pb_istream_s 10 | 11 | std::vector pbEncode(const pb_msgdesc_t* fields, 12 | const void* src_struct); 13 | 14 | pb_bytes_array_t* vectorToPbArray(const std::vector& vectorToPack); 15 | 16 | void packString(char*& dst, std::string stringToPack); 17 | 18 | std::vector pbArrayToVector(pb_bytes_array_t* pbArray); 19 | 20 | template 21 | T pbDecode(const pb_msgdesc_t* fields, std::vector& data) { 22 | 23 | T result = {}; 24 | // Create stream 25 | pb_istream_t stream = pb_istream_from_buffer(&data[0], data.size()); 26 | 27 | // Decode the message 28 | if (pb_decode(&stream, fields, &result) == false) { 29 | printf("Decode failed: %s\n", PB_GET_ERROR(&stream)); 30 | } 31 | 32 | return result; 33 | } 34 | 35 | template 36 | void pbDecode(T& result, const pb_msgdesc_t* fields, 37 | std::vector& data) { 38 | // Create stream 39 | pb_istream_t stream = pb_istream_from_buffer(&data[0], data.size()); 40 | 41 | // Decode the message 42 | if (pb_decode(&stream, fields, &result) == false) { 43 | printf("Decode failed: %s\n", PB_GET_ERROR(&stream)); 44 | } 45 | } 46 | 47 | void pbPutString(const std::string& stringToPack, char* dst); 48 | void pbPutCharArray(const char* stringToPack, char* dst); 49 | void pbPutBytes(const std::vector& data, pb_bytes_array_t& dst); 50 | 51 | const char* pb_encode_to_string(const pb_msgdesc_t* fields, const void* data); 52 | -------------------------------------------------------------------------------- /components/cspot/bell-utils/include/TimeDefs.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Filip Grzywok on 28/02/2022. 3 | // 4 | 5 | #ifndef EUPHONIUMCLI_TIMEDEFS_H 6 | #define EUPHONIUMCLI_TIMEDEFS_H 7 | 8 | #endif // EUPHONIUMCLI_TIMEDEFS_H 9 | -------------------------------------------------------------------------------- /components/cspot/component.mk: -------------------------------------------------------------------------------- 1 | PB_NAMES=$(basename $(notdir $(wildcard $(COMPONENT_PATH)/protobuf/*.proto))) 2 | PB_SRCS=$(PB_NAMES:=.pb.c) 3 | 4 | $(BUILD_DIR_BASE)/cspot/protobuf/%.pb.c: $(COMPONENT_PATH)/protobuf/%.proto | protobuf 5 | /usr/bin/python $(COMPONENT_PATH)/nanopb/generator/nanopb_generator.py -I $(COMPONENT_PATH)/protobuf -D $(BUILD_DIR_BASE)/cspot/protobuf $< 6 | 7 | protobuf: 8 | mkdir -p $(BUILD_DIR_BASE)/cspot/protobuf 9 | 10 | PB_SRCS_FULLP=$(addprefix $(BUILD_DIR_BASE)/cspot/protobuf/, $(PB_SRCS)) 11 | $(info "pb srcs: $(BUILD_DIR_BASE)") 12 | src/AccessKeyFetcher.o: $(PB_SRCS_FULLP) 13 | 14 | COMPONENT_SRCDIRS := ../../build/cspot/protobuf src bell-utils nanopb 15 | COMPONENT_ADD_INCLUDEDIRS += src bell-utils/include nanopb 16 | COMPONENT_EXTRA_INCLUDES := $(BUILD_DIR_BASE)/cspot 17 | COMPONENT_EXTRA_CLEAN := protobuf/*.o 18 | CXXFLAGS += -O3 -std=gnu++17 19 | CFLAGS += -O3 20 | CPPFLAGS=-DESP_PLATFORM=1 -D BELL_ONLY_CJSON=1 -DPB_ENABLE_MALLOC=1 21 | -------------------------------------------------------------------------------- /components/cspot/protobuf/authentication.options: -------------------------------------------------------------------------------- 1 | LoginCredentials.username max_size:30, fixed_length:false 2 | LoginCredentials.auth_data max_size:512, fixed_length:false 3 | SystemInfo.system_information_string max_size:16, fixed_length:false 4 | SystemInfo.device_id max_size:50, fixed_length:false 5 | ClientResponseEncrypted.version_string max_size:32, fixed_length:false 6 | APWelcome.canonical_username max_size:30, fixed_length:false 7 | APWelcome.reusable_auth_credentials max_size:512, fixed_length:false 8 | APWelcome.lfs_secret max_size:128, fixed_length:false 9 | AccountInfoFacebook.access_token max_size:128, fixed_length:false 10 | AccountInfoFacebook.machine_id max_size:50, fixed_length:false 11 | -------------------------------------------------------------------------------- /components/cspot/protobuf/keyexchange.options: -------------------------------------------------------------------------------- 1 | LoginCryptoDiffieHellmanHello.gc max_size:96, fixed_length:true 2 | LoginCryptoDiffieHellmanChallenge.gs max_size:96, fixed_length:true 3 | LoginCryptoDiffieHellmanResponse.hmac max_size:20, fixed_length:true 4 | ClientHello.cryptosuites_supported max_count:1, fixed_count:true 5 | ClientHello.client_nonce max_size:16, fixed_length:true 6 | ClientHello.padding max_size:1, fixed_length:true -------------------------------------------------------------------------------- /components/cspot/protobuf/login5.options: -------------------------------------------------------------------------------- 1 | LoginOk.access_token type: FT_POINTER -------------------------------------------------------------------------------- /components/cspot/protobuf/login5.proto: -------------------------------------------------------------------------------- 1 | // A minimal set of protobuf messages required to auth through login5, with a stored credential. 2 | message StoredCredential { 3 | required string username = 1; 4 | required bytes data = 2; 5 | } 6 | 7 | message ClientInfo { 8 | required string client_id = 1; 9 | required string device_id = 2; 10 | } 11 | 12 | message LoginRequest { 13 | required ClientInfo client_info = 1; 14 | 15 | oneof login_method { 16 | StoredCredential stored_credential = 100; 17 | } 18 | } 19 | 20 | message LoginOk { 21 | required string access_token = 2; 22 | optional int32 access_token_expires_in = 4; 23 | } 24 | 25 | message LoginResponse { 26 | oneof response { 27 | LoginOk ok = 1; 28 | LoginError error = 2; 29 | } 30 | } 31 | 32 | enum LoginError { 33 | UNKNOWN_ERROR = 0; 34 | INVALID_CREDENTIALS = 1; 35 | BAD_REQUEST = 2; 36 | UNSUPPORTED_LOGIN_PROTOCOL = 3; 37 | TIMEOUT = 4; 38 | UNKNOWN_IDENTIFIER = 5; 39 | TOO_MANY_ATTEMPTS = 6; 40 | INVALID_PHONENUMBER = 7; 41 | TRY_AGAIN_LATER = 8; 42 | } -------------------------------------------------------------------------------- /components/cspot/protobuf/mercury.options: -------------------------------------------------------------------------------- 1 | Header.uri max_size:256, fixed_length:false 2 | Header.method max_size:64, fixed_length:false 3 | -------------------------------------------------------------------------------- /components/cspot/protobuf/mercury.proto: -------------------------------------------------------------------------------- 1 | message Header { 2 | optional string uri = 0x01; 3 | optional string method = 0x03; 4 | } 5 | -------------------------------------------------------------------------------- /components/cspot/protobuf/metadata.options: -------------------------------------------------------------------------------- 1 | Track.name type: FT_POINTER 2 | Track.gid type: FT_POINTER 3 | Track.file type: FT_POINTER 4 | Track.restriction type: FT_POINTER 5 | Track.alternative type: FT_POINTER 6 | Track.artist type: FT_POINTER 7 | AudioFile.file_id type: FT_POINTER 8 | Image.file_id type: FT_POINTER 9 | Artist.gid type: FT_POINTER 10 | Artist.name type: FT_POINTER 11 | Album.name type: FT_POINTER 12 | Episode.gid type: FT_POINTER 13 | Episode.name type: FT_POINTER 14 | ImageGroup.image type: FT_POINTER 15 | Episode.file type: FT_POINTER 16 | Episode.restriction type: FT_POINTER 17 | Episode.covers type: FT_POINTER 18 | Restriction.countries_allowed type: FT_POINTER 19 | Restriction.countries_forbidden type: FT_POINTER -------------------------------------------------------------------------------- /components/cspot/protobuf/metadata.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto2"; 2 | 3 | message AudioFile { 4 | optional bytes file_id = 1; 5 | optional AudioFormat format = 2; 6 | } 7 | 8 | message Restriction { 9 | optional string countries_allowed = 0x2; 10 | optional string countries_forbidden = 0x3; 11 | } 12 | 13 | message Image { 14 | optional bytes file_id = 0x1; 15 | } 16 | 17 | message ImageGroup { 18 | repeated Image image = 0x1; 19 | } 20 | 21 | message Album { 22 | optional bytes gid = 0x1; 23 | optional string name = 0x2; 24 | optional ImageGroup cover_group = 0x11; 25 | } 26 | 27 | message Artist { 28 | optional bytes gid = 0x1; 29 | optional string name = 0x2; 30 | } 31 | 32 | message Track { 33 | optional bytes gid = 1; 34 | optional string name = 2; 35 | optional sint32 number = 5; 36 | optional sint32 disc_number = 6; 37 | optional sint32 duration = 0x7; 38 | optional Album album = 0x3; 39 | repeated Artist artist = 0x4; 40 | repeated Restriction restriction = 0xb; 41 | repeated AudioFile file = 0xc; 42 | repeated Track alternative = 0xd; 43 | } 44 | 45 | message Episode { 46 | optional bytes gid = 1; 47 | optional string name = 2; 48 | optional sint32 duration = 7; 49 | optional sint32 number = 65; 50 | repeated AudioFile file = 12; 51 | repeated Restriction restriction = 0x4B; 52 | optional ImageGroup covers = 0x44; 53 | } 54 | 55 | enum AudioFormat { 56 | OGG_VORBIS_96 = 0; 57 | OGG_VORBIS_160 = 1; 58 | OGG_VORBIS_320 = 2; 59 | MP3_256 = 3; 60 | MP3_320 = 4; 61 | MP3_160 = 5; 62 | MP3_96 = 6; 63 | MP3_160_ENC = 7; 64 | AAC_24 = 8; 65 | AAC_48 = 9; 66 | } 67 | -------------------------------------------------------------------------------- /components/cspot/protobuf/spirc.options: -------------------------------------------------------------------------------- 1 | Frame.ident type:FT_POINTER 2 | Frame.protocol_version type:FT_POINTER 3 | Frame.recipient type:FT_POINTER 4 | Capability.stringValue max_count:50, max_size: 50 5 | Capability.intValue max_count:50 6 | DeviceState.sw_version type:FT_POINTER 7 | DeviceState.name type:FT_POINTER 8 | DeviceState.capabilities max_count:17, fixed_count:false 9 | State.context_uri type:FT_POINTER 10 | TrackRef.queued type:FT_CALLBACK -------------------------------------------------------------------------------- /components/cspot/src/AccessKeyFetcher.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include // or std::atomic 4 | #include // for function 5 | #include // for shared_ptr 6 | #include // for string 7 | 8 | namespace cspot { 9 | struct Context; 10 | 11 | class AccessKeyFetcher { 12 | public: 13 | AccessKeyFetcher(Context& ctx): mCtx(ctx) {} 14 | 15 | /** 16 | * @brief Checks if key is expired 17 | * @returns true when currently held access key is not valid 18 | */ 19 | bool isExpired(); 20 | 21 | /** 22 | * @brief Fetches a new access key 23 | * @remark In case the key is expired, this function blocks until a refresh is done. 24 | * @returns access key 25 | */ 26 | std::string getAccessKey(); 27 | 28 | /** 29 | * @brief Forces a refresh of the access key 30 | */ 31 | void updateAccessKey(); 32 | 33 | private: 34 | Context& mCtx; 35 | std::atomic keyPending = false; 36 | std::string accessKey; 37 | long long int expiresAt; 38 | }; 39 | } // namespace cspot 40 | -------------------------------------------------------------------------------- /components/cspot/src/ApResolve.cpp: -------------------------------------------------------------------------------- 1 | #include "ApResolve.h" 2 | 3 | #include // for initializer_list 4 | #include // for operator!=, operator== 5 | #include // for allocator, unique_ptr 6 | #include // for string_view 7 | #include // for vector 8 | 9 | #include 10 | #ifdef BELL_ONLY_CJSON 11 | #include "cJSON.h" 12 | #else 13 | #include "nlohmann/json.hpp" // for basic_json<>::object_t, basic_json 14 | #include "nlohmann/json_fwd.hpp" // for json 15 | #endif 16 | 17 | using namespace cspot; 18 | 19 | ApResolve::ApResolve(std::string apOverride) { 20 | this->apOverride = apOverride; 21 | } 22 | 23 | std::string ApResolve::fetchFirstApAddress() { 24 | if (apOverride != "") { 25 | return apOverride; 26 | } 27 | 28 | DynBuffer response = httpGet("https://apresolve.spotify.com/"); 29 | #ifdef BELL_ONLY_CJSON 30 | cJSON* json = cJSON_Parse(response.buf()); 31 | const char* apstr = cJSON_GetArrayItem(cJSON_GetObjectItem(json, "ap_list"), 0)->valuestring; 32 | std::string result(apstr ? apstr : ""); 33 | cJSON_Delete(json); 34 | return result; 35 | #else 36 | auto json = nlohmann::json::parse(responseStr); 37 | return json["ap_list"][0]; 38 | #endif 39 | } 40 | -------------------------------------------------------------------------------- /components/cspot/src/ApResolve.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include // for string 4 | #ifdef BELL_ONLY_CJSON 5 | #include "cJSON.h" 6 | #else 7 | #endif 8 | 9 | namespace cspot { 10 | class ApResolve { 11 | public: 12 | ApResolve(std::string apOverride); 13 | 14 | /** 15 | * @brief Connects to spotify's servers and returns first valid ap address 16 | * @returns std::string Address in form of url:port 17 | */ 18 | std::string fetchFirstApAddress(); 19 | 20 | private: 21 | std::string apOverride; 22 | }; 23 | } // namespace cspot 24 | -------------------------------------------------------------------------------- /components/cspot/src/AuthChallenges.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include // for uint8_t 4 | #include // for unique_ptr 5 | #include // for string 6 | #include // for vector 7 | 8 | #include "Crypto.h" // for Crypto 9 | #include "protobuf/authentication.pb.h" // for ClientResponseEncrypted 10 | #include "protobuf/keyexchange.pb.h" // for APResponseMessage, ClientHello 11 | 12 | namespace cspot { 13 | class AuthChallenges { 14 | public: 15 | AuthChallenges(); 16 | ~AuthChallenges(); 17 | 18 | /** 19 | * @brief Prepares a spotify authentication packet 20 | * @param authBlob authentication blob bytes 21 | * @param authType value representing spotify's authentication type 22 | * @param deviceId device id to use during auth. 23 | * @param username spotify's username 24 | * 25 | * @returns vector containing bytes of the authentication packet 26 | */ 27 | std::vector prepareAuthPacket(const std::vector& authBlob, 28 | int authType, 29 | const std::string& deviceId, 30 | const std::string& username); 31 | 32 | /** 33 | * @brief Solves the ApHello packet, and returns a packet with response 34 | * 35 | * @param helloPacket hello packet bytes received from the server 36 | * @param data authentication data received from the server 37 | * 38 | * @returns vector containing response packet 39 | */ 40 | std::vector solveApHello(std::vector& helloPacket, 41 | std::vector& data); 42 | 43 | /** 44 | * @brief Prepares an client hello packet, used for initial auth with spotify 45 | * 46 | * @returns vector containing the packet's data 47 | */ 48 | std::vector prepareClientHello(); 49 | 50 | std::vector shanSendKey = {}; 51 | std::vector shanRecvKey = {}; 52 | 53 | private: 54 | const long long SPOTIFY_VERSION = 0x10800000000; 55 | 56 | // Protobuf structures 57 | ClientResponseEncrypted authRequest; 58 | ClientResponsePlaintext clientResPlaintext; 59 | ClientHello clientHello; 60 | APResponseMessage apResponse; 61 | 62 | std::unique_ptr crypto; 63 | }; 64 | } // namespace cspot 65 | -------------------------------------------------------------------------------- /components/cspot/src/CSpotContext.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | #include "Crypto.h" 7 | #include "LoginBlob.h" 8 | #include "MercurySession.h" 9 | #include "TimeProvider.h" 10 | #include "protobuf/authentication.pb.h" // for AuthenticationType_AUTHE... 11 | #include "protobuf/metadata.pb.h" 12 | #ifdef BELL_ONLY_CJSON 13 | #include "cJSON.h" 14 | #else 15 | #include "nlohmann/detail/json_pointer.hpp" // for json_pointer<>::string_t 16 | #include "nlohmann/json.hpp" // for basic_json<>::object_t, basic_json 17 | #include "nlohmann/json_fwd.hpp" // for json 18 | #endif 19 | 20 | namespace cspot { 21 | struct Context { 22 | struct ConfigState { 23 | // Setup default bitrate to 160 24 | AudioFormat audioFormat = AudioFormat::AudioFormat_OGG_VORBIS_160; 25 | std::string deviceId; 26 | std::string deviceName; 27 | std::vector authData; 28 | int volume; 29 | 30 | std::string username; 31 | std::string countryCode; 32 | }; 33 | ConfigState mConfig; 34 | TimeProvider mTimeProvider; 35 | MercurySession mSession; 36 | 37 | std::string getCredentialsJson() { 38 | #ifdef BELL_ONLY_CJSON 39 | cJSON* json_obj = cJSON_CreateObject(); 40 | cJSON_AddStringToObject(json_obj, "authData", 41 | Crypto::base64Encode(mConfig.authData).c_str()); 42 | cJSON_AddNumberToObject( 43 | json_obj, "authType", 44 | AuthenticationType_AUTHENTICATION_STORED_SPOTIFY_CREDENTIALS); 45 | cJSON_AddStringToObject(json_obj, "username", mConfig.username.c_str()); 46 | 47 | char* str = cJSON_PrintUnformatted(json_obj); 48 | cJSON_Delete(json_obj); 49 | std::string json_objStr(str); 50 | free(str); 51 | 52 | return json_objStr; 53 | #else 54 | nlohmann::json obj; 55 | obj["authData"] = Crypto::base64Encode(config.authData); 56 | obj["authType"] = 57 | AuthenticationType_AUTHENTICATION_STORED_SPOTIFY_CREDENTIALS; 58 | obj["username"] = config.username; 59 | 60 | return obj.dump(); 61 | #endif 62 | } 63 | 64 | Context(const LoginBlob& blob): mSession(blob, mTimeProvider) 65 | { 66 | mConfig.deviceId = blob.getDeviceId(); 67 | mConfig.deviceName = blob.getDeviceName(); 68 | mConfig.authData = blob.authData; 69 | mConfig.volume = 0; 70 | mConfig.username = blob.getUserName(); 71 | } 72 | }; 73 | } // namespace cspot 74 | -------------------------------------------------------------------------------- /components/cspot/src/ConstantParameters.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #define MAX_VOLUME 65536 4 | 5 | // variable weakly set in ZeroconfAuthentificator.cpp 6 | extern char deviceId[]; 7 | 8 | namespace cspot { 9 | // Hardcoded information sent to spotify servers 10 | const char* const informationString = "cspot-player"; 11 | const char* const brandName = "cspot"; 12 | const char* const versionString = "cspot-1.1"; 13 | const char* const protocolVersion = "2.7.1"; 14 | const char* const defaultDeviceName = "CSpot"; 15 | const char* const swVersion = "1.0.0"; 16 | 17 | } // namespace cspot -------------------------------------------------------------------------------- /components/cspot/src/CspotAssert.h: -------------------------------------------------------------------------------- 1 | #ifndef CSPOT_ASSERT_H 2 | #define CSPOT_ASSERT_H 3 | #include 4 | #include 5 | 6 | #define CSPOT_ASSERT(CONDITION, MESSAGE) \ 7 | do { \ 8 | if (!(CONDITION)) { \ 9 | printf("At %s in %s:%d\n Assertion %s failed: %s", __func__, __FILE__, \ 10 | __LINE__, #CONDITION, MESSAGE); \ 11 | abort(); \ 12 | } \ 13 | } while (0) 14 | 15 | #endif 16 | -------------------------------------------------------------------------------- /components/cspot/src/Logger.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #undef LOG_LOCAL_LEVEL 5 | #define LOG_LOCAL_LEVEL ESP_LOG_VERBOSE 6 | #include 7 | 8 | inline static const char* strOrNull(const char* str) { 9 | return str ? str : "(null)"; 10 | } 11 | #define CSPOT_LOG(type, ...) \ 12 | do { \ 13 | bell::bellGlobalLogger->type(__FILE__, __LINE__, "cspot", __VA_ARGS__); \ 14 | } while (0) 15 | #define TRKLDR_LOGI(fmt,...) ESP_LOGI("cspot-load", fmt, ##__VA_ARGS__) 16 | #define TRKLDR_LOGD(fmt,...) ESP_LOGD("cspot-load", fmt, ##__VA_ARGS__) 17 | #define TRKLDR_LOGW(fmt,...) ESP_LOGW("cspot-load", fmt, ##__VA_ARGS__) 18 | #define TRKLDR_LOGE(fmt,...) ESP_LOGE("cspot-load", fmt, ##__VA_ARGS__) 19 | 20 | #define MERCURY_LOGI(fmt,...) ESP_LOGI(TAG, fmt, ##__VA_ARGS__) 21 | #define MERCURY_LOGE(fmt,...) ESP_LOGE(TAG, fmt, ##__VA_ARGS__) 22 | #define MERCURY_LOGD(fmt,...) ESP_LOGD(TAG, fmt, ##__VA_ARGS__) 23 | #define MERCURY_LOGP(fmt,...) // protocol logging 24 | 25 | #define SPIRC_LOGI(fmt,...) ESP_LOGI("spirc", fmt, ##__VA_ARGS__) 26 | #define SPIRC_LOGP(fmt,...) ESP_LOGI("spirc", "\e[34m" fmt, ##__VA_ARGS__) 27 | #define SPIRC_LOGE(fmt,...) ESP_LOGE("spirc", fmt, ##__VA_ARGS__) 28 | #define SPIRC_LOGW(fmt,...) ESP_LOGW("spirc", fmt, ##__VA_ARGS__) 29 | #define SPIRC_LOGD(fmt,...) ESP_LOGD("spirc", fmt, ##__VA_ARGS__) 30 | -------------------------------------------------------------------------------- /components/cspot/src/LoginBlob.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include // for uint8_t, uint32_t 4 | #include // for map 5 | #include // for unique_ptr 6 | #include // for string 7 | #include // for vector 8 | 9 | #include "Crypto.h" // for CryptoMbedTLS, Crypto 10 | 11 | namespace cspot { 12 | class LoginBlob { 13 | private: 14 | int blobSkipPosition = 0; 15 | std::unique_ptr crypto; 16 | std::string name, deviceId; 17 | 18 | uint32_t readBlobInt(const std::vector& loginData); 19 | std::vector decodeBlob(const std::vector& blob, 20 | const std::vector& sharedKey); 21 | std::vector decodeBlobSecondary(const std::vector& blob, 22 | const std::string& username, 23 | const std::string& deviceId); 24 | 25 | public: 26 | LoginBlob(std::string name); 27 | std::vector authData; 28 | std::string username = ""; 29 | int authType; 30 | 31 | // Loading 32 | void loadZeroconfQuery(std::map& queryParams); 33 | void loadZeroconf(const std::vector& blob, 34 | const std::vector& sharedKey, 35 | const std::string& deviceId, const std::string& username); 36 | void loadUserPass(const std::string& username, const std::string& password); 37 | void loadJson(const std::string& json); 38 | 39 | std::string buildZeroconfInfo(); 40 | const std::string& getDeviceId() const { return deviceId; } 41 | const std::string& getDeviceName() const { return name; } 42 | const std::string& getUserName() const { return username; } 43 | std::string toJson(); 44 | }; 45 | } // namespace cspot 46 | -------------------------------------------------------------------------------- /components/cspot/src/Packet.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | namespace cspot { 7 | struct Packet { 8 | uint8_t command; 9 | std::vector data; 10 | }; 11 | } // namespace cspot -------------------------------------------------------------------------------- /components/cspot/src/PlainConnection.h: -------------------------------------------------------------------------------- 1 | #ifndef PLAINCONNECTION_H 2 | #define PLAINCONNECTION_H 3 | #ifdef _WIN32 4 | #include 5 | #include 6 | 7 | #include "win32shim.h" 8 | #else 9 | #include // for size_t 10 | #endif 11 | #include // for uint8_t 12 | #include // for function 13 | #include // for string 14 | #include // for vector 15 | 16 | typedef std::function timeoutCallback; 17 | 18 | namespace cspot { 19 | class PlainConnection { 20 | public: 21 | PlainConnection(); 22 | ~PlainConnection(); 23 | 24 | /** 25 | * @brief Connect to the given AP address 26 | * 27 | * @param apAddress The AP url to connect to 28 | */ 29 | void connect(const std::string& apAddress); 30 | void close(); 31 | 32 | timeoutCallback timeoutHandler; 33 | std::vector sendPrefixPacket(const std::vector& prefix, 34 | const std::vector& data); 35 | std::vector recvPacket(); 36 | 37 | void readBlock(const uint8_t* dst, size_t size); 38 | size_t writeBlock(const std::vector& data); 39 | 40 | private: 41 | int apSock; 42 | }; 43 | } // namespace cspot 44 | 45 | #endif -------------------------------------------------------------------------------- /components/cspot/src/Session.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include // for uint8_t 4 | #include // for shared_ptr, unique_ptr 5 | #include // for string 6 | #include // for vector 7 | #include "AuthChallenges.h" 8 | 9 | namespace cspot { 10 | class LoginBlob; 11 | class PlainConnection; 12 | class ShannonConnection; 13 | } // namespace cspot 14 | 15 | #define LOGIN_REQUEST_COMMAND 0xAB 16 | #define AUTH_SUCCESSFUL_COMMAND 0xAC 17 | #define AUTH_DECLINED_COMMAND 0xAD 18 | 19 | namespace cspot { 20 | class Session { 21 | protected: 22 | const LoginBlob& mLoginBlob; 23 | cspot::AuthChallenges mChallenges; 24 | std::shared_ptr conn; 25 | std::string deviceId = "142137fd329622137a14901634264e6f332e2411"; 26 | 27 | public: 28 | Session(const LoginBlob& loginBlob); 29 | ~Session() {} 30 | 31 | std::shared_ptr shanConn; 32 | 33 | void connect(std::unique_ptr connection); 34 | void connectWithRandomAp(); 35 | void close(); 36 | virtual bool triggerTimeout() = 0; 37 | std::vector authenticate(); 38 | }; 39 | } // namespace cspot 40 | -------------------------------------------------------------------------------- /components/cspot/src/Shannon.h: -------------------------------------------------------------------------------- 1 | #ifndef SHANNON_H 2 | #define SHANNON_H 3 | 4 | #include // for uint32_t, uint8_t 5 | #include // for vector 6 | 7 | class Shannon { 8 | public: 9 | static constexpr unsigned int N = 16; 10 | 11 | void key(const std::vector& key); /* set key */ 12 | void nonce(const std::vector& nonce); /* set Init Vector */ 13 | void stream(std::vector& buf); /* stream cipher */ 14 | void maconly(std::vector& buf); /* accumulate MAC */ 15 | void encrypt(std::vector& buf); /* encrypt + MAC */ 16 | void decrypt(std::vector& buf); /* finalize + MAC */ 17 | void finish(std::vector& buf); /* finalise MAC */ 18 | 19 | private: 20 | static constexpr unsigned int FOLD = Shannon::N; 21 | static constexpr unsigned int INITKONST = 0x6996c53a; 22 | static constexpr unsigned int KEYP = 13; 23 | uint32_t R[Shannon::N]; 24 | uint32_t CRC[Shannon::N]; 25 | uint32_t initR[Shannon::N]; 26 | uint32_t konst; 27 | uint32_t sbuf; 28 | uint32_t mbuf; 29 | int nbuf; 30 | static uint32_t sbox1(uint32_t w); 31 | static uint32_t sbox2(uint32_t w); 32 | void cycle(); 33 | void crcfunc(uint32_t i); 34 | void macfunc(uint32_t i); 35 | void initState(); 36 | void saveState(); 37 | void reloadState(); 38 | void genkonst(); 39 | void diffuse(); 40 | void loadKey(const std::vector& key); 41 | }; 42 | 43 | #endif -------------------------------------------------------------------------------- /components/cspot/src/ShannonConnection.h: -------------------------------------------------------------------------------- 1 | #ifndef SHANNONCONNECTION_H 2 | #define SHANNONCONNECTION_H 3 | 4 | #include // for uint8_t, uint32_t 5 | #include // for shared_ptr, unique_ptr 6 | #include // for mutex 7 | #include // for vector 8 | 9 | #include "Packet.h" // for Packet 10 | 11 | class Shannon; 12 | namespace cspot { 13 | 14 | class PlainConnection; 15 | } // namespace cspot 16 | 17 | #define MAC_SIZE 4 18 | namespace cspot { 19 | class ShannonConnection { 20 | private: 21 | std::unique_ptr sendCipher; 22 | std::unique_ptr recvCipher; 23 | uint32_t sendNonce = 0; 24 | uint32_t recvNonce = 0; 25 | std::vector cipherPacket(uint8_t cmd, std::vector& data); 26 | std::mutex writeMutex; 27 | std::mutex readMutex; 28 | 29 | public: 30 | ShannonConnection(); 31 | ~ShannonConnection(); 32 | void wrapConnection(std::shared_ptr conn, 33 | std::vector& sendKey, 34 | std::vector& recvKey); 35 | void sendPacket(uint8_t cmd, std::vector& data); 36 | std::shared_ptr conn; 37 | Packet recvPacket(); 38 | }; 39 | } // namespace cspot 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /components/cspot/src/SpircHandler.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include // for uint32_t, uint8_t 4 | #include // for function 5 | #include // for shared_ptr, unique_ptr 6 | #include // for string 7 | #include // for variant 8 | #include // for vector 9 | #include "TrackQueue.h" 10 | #include "protobuf/spirc.pb.h" // for MessageType 11 | #include "CSpotContext.h" 12 | #include "PlaybackState.h" 13 | 14 | namespace cspot { 15 | class LoginBlob; 16 | struct ITrackPlayer { 17 | virtual void play(uint32_t pos) = 0; 18 | virtual void pause(bool paused); 19 | virtual void nextTrack(bool nextPrev) = 0; 20 | virtual void stopPlayback() = 0; 21 | virtual void seekMs(uint32_t pos) = 0; 22 | virtual void setVolume(uint32_t vol) = 0; 23 | }; 24 | 25 | class SpircHandler { 26 | public: 27 | SpircHandler(const cspot::LoginBlob& loginBlob, ITrackPlayer& player); 28 | 29 | enum class EventType { 30 | PLAY_PAUSE, 31 | VOLUME, 32 | TRACK_INFO, 33 | DISC, 34 | NEXT, 35 | PREV, 36 | SEEK, 37 | DEPLETED, 38 | FLUSH, 39 | PLAYBACK_START 40 | }; 41 | static const char* messageTypeToStr(MessageType type); 42 | void subscribeToMercury(); 43 | ITrackPlayer& getTrackPlayer() { return mPlayer; } 44 | void start(); 45 | void setPause(bool pause); 46 | bool previousSong(); 47 | bool nextSong(); 48 | void notifyAudioEnded(); 49 | void notifyCurrTrackUpdate(int trackIdx); 50 | void notifyPositionMs(uint32_t position); 51 | void notifyPausedState(bool paused); 52 | void notifyVolumeSet(uint32_t volume); 53 | void loadTrackFromURI(const std::string& uri); 54 | TrackQueue& getTrackQueue() { return mTrackQueue; } 55 | void disconnect(); 56 | 57 | Context mCtx; 58 | PlaybackState mPlaybackState; 59 | TrackQueue mTrackQueue; 60 | ITrackPlayer& mPlayer; 61 | private: 62 | void sendCmd(MessageType typ); 63 | void handleFrame(std::vector& data); 64 | void notify(); 65 | }; 66 | } // namespace cspot 67 | -------------------------------------------------------------------------------- /components/cspot/src/TimeProvider.cpp: -------------------------------------------------------------------------------- 1 | #include "TimeProvider.h" 2 | 3 | #include "BellLogger.h" // for AbstractLogger 4 | #include "Logger.h" // for CSPOT_LOG 5 | #include "Utils.h" // for extract, getCurrentTimestamp 6 | #ifndef _WIN32 7 | #include 8 | #endif 9 | 10 | using namespace cspot; 11 | 12 | TimeProvider::TimeProvider() {} 13 | 14 | void TimeProvider::syncWithPingPacket(const std::vector& pongPacket) { 15 | CSPOT_LOG(debug, "Time synced with spotify servers"); 16 | // Spotify's timestamp is in seconds since unix time - convert to millis. 17 | uint64_t remoteTimestamp = 18 | ((uint64_t)ntohl(extract(pongPacket, 0))) * 1000; 19 | this->timestampDiff = remoteTimestamp - getCurrentTimestamp(); 20 | } 21 | 22 | unsigned long long TimeProvider::getSyncedTimestamp() { 23 | return getCurrentTimestamp() + this->timestampDiff; 24 | } -------------------------------------------------------------------------------- /components/cspot/src/TimeProvider.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include // for uint8_t 4 | #include // for vector 5 | 6 | namespace cspot { 7 | class TimeProvider { 8 | private: 9 | unsigned long long timestampDiff; 10 | 11 | public: 12 | /** 13 | * @brief Bypasses the need for NTP server sync by syncing with spotify's servers 14 | * 15 | */ 16 | TimeProvider(); 17 | 18 | /** 19 | * @brief Syncs the TimeProvider with spotify server's timestamp 20 | * 21 | * @param pongPacket pong packet containing timestamp 22 | */ 23 | void syncWithPingPacket(const std::vector& pongPacket); 24 | 25 | /** 26 | * @brief Get current timestamp synced with spotify servers 27 | * 28 | * @return unsigned long long timestamp 29 | */ 30 | unsigned long long getSyncedTimestamp(); 31 | }; 32 | } // namespace cspot 33 | -------------------------------------------------------------------------------- /components/cspot/src/TrackReference.cpp: -------------------------------------------------------------------------------- 1 | #include "TrackReference.h" 2 | 3 | #include "NanoPBExtensions.h" 4 | #include "Utils.h" 5 | #include "protobuf/spirc.pb.h" 6 | #include "TrackQueue.h" 7 | 8 | using namespace cspot; 9 | 10 | static constexpr auto base62Alphabet = 11 | "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; 12 | 13 | void TrackReference::decodeURI(const std::string& uri) 14 | { 15 | if (gid.empty()) { 16 | // Episode GID is being fetched via base62 encoded URI 17 | auto idString = uri.substr(uri.find_last_of(":") + 1, uri.size()); 18 | gid = {0}; 19 | 20 | std::string_view alphabet(base62Alphabet); 21 | for (int x = 0; x < idString.size(); x++) { 22 | size_t d = alphabet.find(idString[x]); 23 | gid = bigNumMultiply(gid, 62); 24 | gid = bigNumAdd(gid, d); 25 | } 26 | 27 | if (uri.find("episode:") != std::string::npos) { 28 | type = Type::EPISODE; 29 | } 30 | } 31 | } 32 | 33 | -------------------------------------------------------------------------------- /components/cspot/src/TrackReference.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include "NanoPBHelper.h" 8 | #include "pb_decode.h" 9 | #include 10 | #include 11 | 12 | namespace cspot { 13 | struct TrackGid: public std::vector { 14 | bool operator<(const TrackGid& other) const { 15 | int diff = memcmp(data(), other.data(), std::min(size(), other.size())); 16 | if (size() == other.size()) { 17 | return diff < 0; 18 | } 19 | else { // sizes differ 20 | return (diff == 0) ? size() < other.size() : diff < 0; 21 | } 22 | } 23 | TrackGid& operator=(const std::vector& other) { 24 | std::vector::operator=(other); 25 | return *this; 26 | } 27 | }; 28 | class TrackInfo; 29 | struct TrackReference { 30 | enum Type: int8_t { TRACK, EPISODE }; 31 | TrackGid gid; 32 | Type type = TRACK; 33 | bool operator==(const TrackReference& other) const { 34 | return other.type == type && other.gid == gid; 35 | } 36 | bool operator<(const TrackReference& other) const { 37 | int tdiff = (int8_t)type - (int8_t)other.type; 38 | return tdiff ? tdiff < 0 : gid < other.gid; 39 | } 40 | void decodeURI(const std::string& uri); 41 | }; 42 | } // namespace cspot 43 | -------------------------------------------------------------------------------- /components/equalizer/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | idf_component_register(INCLUDE_DIRS .) 2 | add_prebuilt_library(esp_eq "libeq.a") 3 | target_link_libraries(${COMPONENT_LIB} INTERFACE esp_eq) 4 | -------------------------------------------------------------------------------- /components/equalizer/component.mk: -------------------------------------------------------------------------------- 1 | # 2 | # Main Makefile. This is basically the same as a component makefile. 3 | # 4 | # This Makefile should, at the very least, just include $(SDK_PATH)/make/component_common.mk. By default, 5 | # this will take the sources in the src/ directory, compile them and link them into 6 | # lib(subdirectory_name).a in the build directory. This behaviour is entirely configurable, 7 | # please read the ESP-IDF documents if you need to do this. 8 | # 9 | 10 | COMPONENT_ADD_INCLUDEDIRS += . 11 | COMPONENT_ADD_LDFLAGS := -L$(COMPONENT_PATH) -leq 12 | -------------------------------------------------------------------------------- /components/equalizer/libeq.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alxvasilev/net-player-esp32/e1367196c69028665ef950d16815a7b6aae4aeff/components/equalizer/libeq.a -------------------------------------------------------------------------------- /components/httpLib: -------------------------------------------------------------------------------- 1 | ../esp32-mylibs/httpLib -------------------------------------------------------------------------------- /components/json: -------------------------------------------------------------------------------- 1 | ../../../esp-idf/components/json -------------------------------------------------------------------------------- /components/libFLAC/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | idf_component_register(SRC_DIRS . INCLUDE_DIRS . include REQUIRES libogg) 2 | target_compile_options(${COMPONENT_LIB} PRIVATE -O3 -Wno-incompatible-pointer-types) 3 | target_compile_definitions(${COMPONENT_LIB} PRIVATE -DHAVE_CONFIG_H=1) 4 | -------------------------------------------------------------------------------- /components/libFLAC/component.mk: -------------------------------------------------------------------------------- 1 | COMPONENT_SRCDIRS := . 2 | COMPONENT_ADD_INCLUDEDIRS += . ./include 3 | CFLAGS += -O3 -DHAVE_CONFIG_H -Dmalloc=my_malloc -Drealloc=my_realloc 4 | -------------------------------------------------------------------------------- /components/libFLAC/deduplication/lpc_compute_autocorrelation_intrin.c: -------------------------------------------------------------------------------- 1 | int i, j; 2 | (void) lag; 3 | FLAC__ASSERT(lag <= MAX_LAG); 4 | 5 | for(i = 0; i < MAX_LAG; i++) 6 | autoc[i] = 0.0; 7 | 8 | for(i = 0; i < MAX_LAG; i++) 9 | for(j = 0; j <= i; j++) 10 | autoc[j] += (double)data[i] * (double)data[i-j]; 11 | 12 | for(i = MAX_LAG; i < (int)data_len; i++) 13 | for(j = 0; j < MAX_LAG; j++) 14 | autoc[j] += (double)data[i] * (double)data[i-j]; 15 | -------------------------------------------------------------------------------- /components/libFLAC/deduplication/lpc_compute_autocorrelation_intrin_neon.c: -------------------------------------------------------------------------------- 1 | int i; 2 | float64x2_t sum0 = vdupq_n_f64(0.0f); 3 | float64x2_t sum1 = vdupq_n_f64(0.0f); 4 | float64x2_t sum2 = vdupq_n_f64(0.0f); 5 | float64x2_t sum3 = vdupq_n_f64(0.0f); 6 | float64x2_t d0 = vdupq_n_f64(0.0f); 7 | float64x2_t d1 = vdupq_n_f64(0.0f); 8 | float64x2_t d2 = vdupq_n_f64(0.0f); 9 | float64x2_t d3 = vdupq_n_f64(0.0f); 10 | #if MAX_LAG > 8 11 | float64x2_t sum4 = vdupq_n_f64(0.0f); 12 | float64x2_t d4 = vdupq_n_f64(0.0f); 13 | #endif 14 | #if MAX_LAG > 10 15 | float64x2_t sum5 = vdupq_n_f64(0.0f); 16 | float64x2_t sum6 = vdupq_n_f64(0.0f); 17 | float64x2_t d5 = vdupq_n_f64(0.0f); 18 | float64x2_t d6 = vdupq_n_f64(0.0f); 19 | #endif 20 | float64x2_t d; 21 | 22 | (void)lag; 23 | FLAC__ASSERT(lag <= MAX_LAG); 24 | 25 | // Loop backwards through samples from data_len to 0 26 | for (i = data_len - 1; i >= 0; i--) 27 | { 28 | d = vdupq_n_f64(data[i]); // Create vector with 2 entries data[i] 29 | 30 | // The next 6 lines of code right-shift the elements through the 7 vectors d0..d6. 31 | // The 7th line adds the newly loaded element to d0. This works like a stack, where 32 | // data[i] is pushed onto the stack every time and the 9th element falls off 33 | #if MAX_LAG > 10 34 | d6 = vextq_f64(d5,d6,1); 35 | d5 = vextq_f64(d4,d5,1); 36 | #endif 37 | #if MAX_LAG > 8 38 | d4 = vextq_f64(d3,d4,1); 39 | #endif 40 | d3 = vextq_f64(d2,d3,1); 41 | d2 = vextq_f64(d1,d2,1); 42 | d1 = vextq_f64(d0,d1,1); 43 | d0 = vextq_f64(d,d0,1); 44 | 45 | // Fused multiply-add sum += d * d0..d6 46 | sum0 = vfmaq_f64(sum0, d, d0); 47 | sum1 = vfmaq_f64(sum1, d, d1); 48 | sum2 = vfmaq_f64(sum2, d, d2); 49 | sum3 = vfmaq_f64(sum3, d, d3); 50 | #if MAX_LAG > 8 51 | sum4 = vfmaq_f64(sum4, d, d4); 52 | #endif 53 | #if MAX_LAG > 10 54 | sum5 = vfmaq_f64(sum5, d, d5); 55 | sum6 = vfmaq_f64(sum6, d, d6); 56 | #endif 57 | } 58 | 59 | // Store sum0..sum6 in autoc[0..14] 60 | vst1q_f64(autoc, sum0); 61 | vst1q_f64(autoc + 2, sum1); 62 | vst1q_f64(autoc + 4, sum2); 63 | vst1q_f64(autoc + 6, sum3); 64 | #if MAX_LAG > 8 65 | vst1q_f64(autoc + 8, sum4); 66 | #endif 67 | #if MAX_LAG > 10 68 | vst1q_f64(autoc + 10, sum5); 69 | vst1q_f64(autoc + 12, sum6); 70 | #endif 71 | -------------------------------------------------------------------------------- /components/libFLAC/include/FLAC/Makefile.am: -------------------------------------------------------------------------------- 1 | # libFLAC - Free Lossless Audio Codec library 2 | # Copyright (C) 2000-2009 Josh Coalson 3 | # Copyright (C) 2011-2022 Xiph.Org Foundation 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted provided that the following conditions 7 | # are met: 8 | # 9 | # - Redistributions of source code must retain the above copyright 10 | # notice, this list of conditions and the following disclaimer. 11 | # 12 | # - Redistributions in binary form must reproduce the above copyright 13 | # notice, this list of conditions and the following disclaimer in the 14 | # documentation and/or other materials provided with the distribution. 15 | # 16 | # - Neither the name of the Xiph.org Foundation nor the names of its 17 | # contributors may be used to endorse or promote products derived from 18 | # this software without specific prior written permission. 19 | # 20 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | # ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR 24 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 25 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 26 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 27 | # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 28 | # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 29 | # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 30 | # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | 32 | flaccincludedir = $(includedir)/FLAC 33 | 34 | flaccinclude_HEADERS = \ 35 | all.h \ 36 | assert.h \ 37 | callback.h \ 38 | export.h \ 39 | format.h \ 40 | metadata.h \ 41 | ordinals.h \ 42 | stream_decoder.h \ 43 | stream_encoder.h 44 | -------------------------------------------------------------------------------- /components/libFLAC/include/FLAC/assert.h: -------------------------------------------------------------------------------- 1 | /* libFLAC - Free Lossless Audio Codec library 2 | * Copyright (C) 2001-2009 Josh Coalson 3 | * Copyright (C) 2011-2022 Xiph.Org Foundation 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 9 | * - Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 12 | * - Redistributions in binary form must reproduce the above copyright 13 | * notice, this list of conditions and the following disclaimer in the 14 | * documentation and/or other materials provided with the distribution. 15 | * 16 | * - Neither the name of the Xiph.org Foundation nor the names of its 17 | * contributors may be used to endorse or promote products derived from 18 | * this software without specific prior written permission. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR 24 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 25 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 26 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 27 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 28 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 29 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 30 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | */ 32 | 33 | #ifndef FLAC__ASSERT_H 34 | #define FLAC__ASSERT_H 35 | 36 | /* we need this since some compilers (like MSVC) leave assert()s on release code (and we don't want to use their ASSERT) */ 37 | #ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION 38 | #define FLAC__ASSERT(x) if(!(x)) __builtin_abort(); 39 | #define FLAC__ASSERT_DECLARATION(x) x 40 | #else 41 | #ifndef NDEBUG 42 | #include 43 | #define FLAC__ASSERT(x) assert(x) 44 | #define FLAC__ASSERT_DECLARATION(x) x 45 | #else 46 | #define FLAC__ASSERT(x) 47 | #define FLAC__ASSERT_DECLARATION(x) 48 | #endif 49 | #endif 50 | 51 | #endif 52 | -------------------------------------------------------------------------------- /components/libFLAC/include/FLAC/ordinals.h: -------------------------------------------------------------------------------- 1 | /* libFLAC - Free Lossless Audio Codec library 2 | * Copyright (C) 2000-2009 Josh Coalson 3 | * Copyright (C) 2011-2022 Xiph.Org Foundation 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 9 | * - Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 12 | * - Redistributions in binary form must reproduce the above copyright 13 | * notice, this list of conditions and the following disclaimer in the 14 | * documentation and/or other materials provided with the distribution. 15 | * 16 | * - Neither the name of the Xiph.org Foundation nor the names of its 17 | * contributors may be used to endorse or promote products derived from 18 | * this software without specific prior written permission. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR 24 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 25 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 26 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 27 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 28 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 29 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 30 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | */ 32 | 33 | #ifndef FLAC__ORDINALS_H 34 | #define FLAC__ORDINALS_H 35 | 36 | /* This of course assumes C99 headers */ 37 | 38 | #include 39 | #include 40 | 41 | typedef int8_t FLAC__int8; 42 | typedef uint8_t FLAC__uint8; 43 | 44 | typedef int16_t FLAC__int16; 45 | typedef int32_t FLAC__int32; 46 | typedef int64_t FLAC__int64; 47 | typedef uint16_t FLAC__uint16; 48 | typedef uint32_t FLAC__uint32; 49 | typedef uint64_t FLAC__uint64; 50 | 51 | typedef int FLAC__bool; 52 | 53 | typedef FLAC__uint8 FLAC__byte; 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /components/libFLAC/include/Makefile.am: -------------------------------------------------------------------------------- 1 | # libFLAC - Free Lossless Audio Codec library 2 | # Copyright (C) 2001-2009 Josh Coalson 3 | # Copyright (C) 2011-2022 Xiph.Org Foundation 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted provided that the following conditions 7 | # are met: 8 | # 9 | # - Redistributions of source code must retain the above copyright 10 | # notice, this list of conditions and the following disclaimer. 11 | # 12 | # - Redistributions in binary form must reproduce the above copyright 13 | # notice, this list of conditions and the following disclaimer in the 14 | # documentation and/or other materials provided with the distribution. 15 | # 16 | # - Neither the name of the Xiph.org Foundation nor the names of its 17 | # contributors may be used to endorse or promote products derived from 18 | # this software without specific prior written permission. 19 | # 20 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | # ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR 24 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 25 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 26 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 27 | # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 28 | # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 29 | # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 30 | # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | 32 | SUBDIRS = private protected 33 | -------------------------------------------------------------------------------- /components/libFLAC/include/private/Makefile.am: -------------------------------------------------------------------------------- 1 | # libFLAC - Free Lossless Audio Codec library 2 | # Copyright (C) 2001-2009 Josh Coalson 3 | # Copyright (C) 2011-2022 Xiph.Org Foundation 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted provided that the following conditions 7 | # are met: 8 | # 9 | # - Redistributions of source code must retain the above copyright 10 | # notice, this list of conditions and the following disclaimer. 11 | # 12 | # - Redistributions in binary form must reproduce the above copyright 13 | # notice, this list of conditions and the following disclaimer in the 14 | # documentation and/or other materials provided with the distribution. 15 | # 16 | # - Neither the name of the Xiph.org Foundation nor the names of its 17 | # contributors may be used to endorse or promote products derived from 18 | # this software without specific prior written permission. 19 | # 20 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | # ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR 24 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 25 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 26 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 27 | # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 28 | # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 29 | # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 30 | # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | 32 | noinst_HEADERS = \ 33 | all.h \ 34 | bitmath.h \ 35 | bitreader.h \ 36 | bitwriter.h \ 37 | cpu.h \ 38 | crc.h \ 39 | fixed.h \ 40 | float.h \ 41 | format.h \ 42 | lpc.h \ 43 | macros.h \ 44 | md5.h \ 45 | memory.h \ 46 | metadata.h \ 47 | ogg_decoder_aspect.h \ 48 | ogg_encoder_aspect.h \ 49 | ogg_helper.h \ 50 | ogg_mapping.h \ 51 | stream_encoder.h \ 52 | stream_encoder_framing.h \ 53 | window.h 54 | -------------------------------------------------------------------------------- /components/libFLAC/include/private/all.h: -------------------------------------------------------------------------------- 1 | /* libFLAC - Free Lossless Audio Codec library 2 | * Copyright (C) 2000-2009 Josh Coalson 3 | * Copyright (C) 2011-2022 Xiph.Org Foundation 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 9 | * - Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 12 | * - Redistributions in binary form must reproduce the above copyright 13 | * notice, this list of conditions and the following disclaimer in the 14 | * documentation and/or other materials provided with the distribution. 15 | * 16 | * - Neither the name of the Xiph.org Foundation nor the names of its 17 | * contributors may be used to endorse or promote products derived from 18 | * this software without specific prior written permission. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR 24 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 25 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 26 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 27 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 28 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 29 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 30 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | */ 32 | 33 | #ifndef FLAC__PRIVATE__ALL_H 34 | #define FLAC__PRIVATE__ALL_H 35 | 36 | #include "bitmath.h" 37 | #include "bitreader.h" 38 | #include "bitwriter.h" 39 | #include "cpu.h" 40 | #include "crc.h" 41 | #include "fixed.h" 42 | #include "float.h" 43 | #include "format.h" 44 | #include "lpc.h" 45 | #include "md5.h" 46 | #include "memory.h" 47 | #include "metadata.h" 48 | #include "stream_encoder_framing.h" 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /components/libFLAC/include/private/md5.h: -------------------------------------------------------------------------------- 1 | #ifndef FLAC__PRIVATE__MD5_H 2 | #define FLAC__PRIVATE__MD5_H 3 | 4 | /* 5 | * This is the header file for the MD5 message-digest algorithm. 6 | * The algorithm is due to Ron Rivest. This code was 7 | * written by Colin Plumb in 1993, no copyright is claimed. 8 | * This code is in the public domain; do with it what you wish. 9 | * 10 | * Equivalent code is available from RSA Data Security, Inc. 11 | * This code has been tested against that, and is equivalent, 12 | * except that you don't need to include two pages of legalese 13 | * with every copy. 14 | * 15 | * To compute the message digest of a chunk of bytes, declare an 16 | * MD5Context structure, pass it to MD5Init, call MD5Update as 17 | * needed on buffers full of bytes, and then call MD5Final, which 18 | * will fill a supplied 16-byte array with the digest. 19 | * 20 | * Changed so as no longer to depend on Colin Plumb's `usual.h' 21 | * header definitions; now uses stuff from dpkg's config.h 22 | * - Ian Jackson . 23 | * Still in the public domain. 24 | * 25 | * Josh Coalson: made some changes to integrate with libFLAC. 26 | * Still in the public domain, with no warranty. 27 | */ 28 | 29 | #include "FLAC/ordinals.h" 30 | 31 | typedef union { 32 | FLAC__byte *p8; 33 | FLAC__int16 *p16; 34 | FLAC__int32 *p32; 35 | } FLAC__multibyte; 36 | 37 | typedef struct { 38 | FLAC__uint32 in[16]; 39 | FLAC__uint32 buf[4]; 40 | FLAC__uint32 bytes[2]; 41 | FLAC__multibyte internal_buf; 42 | size_t capacity; 43 | } FLAC__MD5Context; 44 | 45 | void FLAC__MD5Init(FLAC__MD5Context *context); 46 | void FLAC__MD5Final(FLAC__byte digest[16], FLAC__MD5Context *context); 47 | 48 | FLAC__bool FLAC__MD5Accumulate(FLAC__MD5Context *ctx, const FLAC__int32 * const signal[], uint32_t channels, uint32_t samples, uint32_t bytes_per_sample); 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /components/libFLAC/include/private/metadata.h: -------------------------------------------------------------------------------- 1 | /* libFLAC - Free Lossless Audio Codec library 2 | * Copyright (C) 2002-2009 Josh Coalson 3 | * Copyright (C) 2011-2022 Xiph.Org Foundation 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 9 | * - Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 12 | * - Redistributions in binary form must reproduce the above copyright 13 | * notice, this list of conditions and the following disclaimer in the 14 | * documentation and/or other materials provided with the distribution. 15 | * 16 | * - Neither the name of the Xiph.org Foundation nor the names of its 17 | * contributors may be used to endorse or promote products derived from 18 | * this software without specific prior written permission. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR 24 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 25 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 26 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 27 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 28 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 29 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 30 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | */ 32 | 33 | #ifndef FLAC__PRIVATE__METADATA_H 34 | #define FLAC__PRIVATE__METADATA_H 35 | 36 | #include "FLAC/metadata.h" 37 | 38 | /* WATCHOUT: all malloc()ed data in the block is free()ed; this may not 39 | * be a consistent state (e.g. PICTURE) or equivalent to the initial 40 | * state after FLAC__metadata_object_new() 41 | */ 42 | void FLAC__metadata_object_delete_data(FLAC__StreamMetadata *object); 43 | 44 | void FLAC__metadata_object_cuesheet_track_delete_data(FLAC__StreamMetadata_CueSheet_Track *object); 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /components/libFLAC/include/protected/Makefile.am: -------------------------------------------------------------------------------- 1 | # libFLAC - Free Lossless Audio Codec library 2 | # Copyright (C) 2001-2009 Josh Coalson 3 | # Copyright (C) 2011-2022 Xiph.Org Foundation 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted provided that the following conditions 7 | # are met: 8 | # 9 | # - Redistributions of source code must retain the above copyright 10 | # notice, this list of conditions and the following disclaimer. 11 | # 12 | # - Redistributions in binary form must reproduce the above copyright 13 | # notice, this list of conditions and the following disclaimer in the 14 | # documentation and/or other materials provided with the distribution. 15 | # 16 | # - Neither the name of the Xiph.org Foundation nor the names of its 17 | # contributors may be used to endorse or promote products derived from 18 | # this software without specific prior written permission. 19 | # 20 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | # ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR 24 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 25 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 26 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 27 | # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 28 | # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 29 | # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 30 | # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | 32 | noinst_HEADERS = \ 33 | all.h \ 34 | stream_decoder.h \ 35 | stream_encoder.h 36 | -------------------------------------------------------------------------------- /components/libFLAC/include/protected/all.h: -------------------------------------------------------------------------------- 1 | /* libFLAC - Free Lossless Audio Codec library 2 | * Copyright (C) 2001-2009 Josh Coalson 3 | * Copyright (C) 2011-2022 Xiph.Org Foundation 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 9 | * - Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 12 | * - Redistributions in binary form must reproduce the above copyright 13 | * notice, this list of conditions and the following disclaimer in the 14 | * documentation and/or other materials provided with the distribution. 15 | * 16 | * - Neither the name of the Xiph.org Foundation nor the names of its 17 | * contributors may be used to endorse or promote products derived from 18 | * this software without specific prior written permission. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR 24 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 25 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 26 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 27 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 28 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 29 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 30 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | */ 32 | 33 | #ifndef FLAC__PROTECTED__ALL_H 34 | #define FLAC__PROTECTED__ALL_H 35 | 36 | #include "stream_decoder.h" 37 | #include "stream_encoder.h" 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /components/libFLAC/include/share/Makefile.am: -------------------------------------------------------------------------------- 1 | ## Process this file with automake to produce Makefile.in 2 | 3 | SUBDIRS = grabbag 4 | 5 | EXTRA_DIST = \ 6 | alloc.h \ 7 | compat.h \ 8 | endswap.h \ 9 | getopt.h \ 10 | grabbag.h \ 11 | macros.h \ 12 | private.h \ 13 | replaygain_analysis.h \ 14 | replaygain_synthesis.h \ 15 | safe_str.h \ 16 | utf8.h \ 17 | win_utf8_io.h 18 | -------------------------------------------------------------------------------- /components/libFLAC/include/share/grabbag.h: -------------------------------------------------------------------------------- 1 | /* grabbag - Convenience lib for various routines common to several tools 2 | * Copyright (C) 2002-2009 Josh Coalson 3 | * Copyright (C) 2011-2022 Xiph.Org Foundation 4 | * 5 | * This library is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 2.1 of the License, or (at your option) any later version. 9 | * 10 | * This library is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public 16 | * License along with this library; if not, write to the Free Software 17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 18 | */ 19 | 20 | #ifndef SHARE__GRABBAG_H 21 | #define SHARE__GRABBAG_H 22 | 23 | /* These can't be included by themselves, only from within grabbag.h */ 24 | #include "grabbag/cuesheet.h" 25 | #include "grabbag/file.h" 26 | #include "grabbag/picture.h" 27 | #include "grabbag/replaygain.h" 28 | #include "grabbag/seektable.h" 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /components/libFLAC/include/share/grabbag/Makefile.am: -------------------------------------------------------------------------------- 1 | ## Process this file with automake to produce Makefile.in 2 | 3 | EXTRA_DIST = \ 4 | cuesheet.h \ 5 | file.h \ 6 | picture.h \ 7 | replaygain.h \ 8 | seektable.h 9 | -------------------------------------------------------------------------------- /components/libFLAC/include/share/grabbag/cuesheet.h: -------------------------------------------------------------------------------- 1 | /* grabbag - Convenience lib for various routines common to several tools 2 | * Copyright (C) 2002-2009 Josh Coalson 3 | * Copyright (C) 2011-2022 Xiph.Org Foundation 4 | * 5 | * This library is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 2.1 of the License, or (at your option) any later version. 9 | * 10 | * This library is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public 16 | * License along with this library; if not, write to the Free Software 17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 18 | */ 19 | 20 | /* This .h cannot be included by itself; #include "share/grabbag.h" instead. */ 21 | 22 | #ifndef GRABBAG__CUESHEET_H 23 | #define GRABBAG__CUESHEET_H 24 | 25 | #include 26 | #include "FLAC/metadata.h" 27 | 28 | #ifdef __cplusplus 29 | extern "C" { 30 | #endif 31 | 32 | uint32_t grabbag__cuesheet_msf_to_frame(uint32_t minutes, uint32_t seconds, uint32_t frames); 33 | void grabbag__cuesheet_frame_to_msf(uint32_t frame, uint32_t *minutes, uint32_t *seconds, uint32_t *frames); 34 | 35 | FLAC__StreamMetadata *grabbag__cuesheet_parse(FILE *file, const char **error_message, uint32_t *last_line_read, uint32_t sample_rate, FLAC__bool is_cdda, FLAC__uint64 lead_out_offset); 36 | 37 | void grabbag__cuesheet_emit(FILE *file, const FLAC__StreamMetadata *cuesheet, const char *file_reference); 38 | 39 | #ifdef __cplusplus 40 | } 41 | #endif 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /components/libFLAC/include/share/grabbag/picture.h: -------------------------------------------------------------------------------- 1 | /* grabbag - Convenience lib for various routines common to several tools 2 | * Copyright (C) 2006-2009 Josh Coalson 3 | * Copyright (C) 2011-2022 Xiph.Org Foundation 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU General Public License 7 | * as published by the Free Software Foundation; either version 2 8 | * of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License along 16 | * with this program; if not, write to the Free Software Foundation, Inc., 17 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 18 | */ 19 | 20 | /* This .h cannot be included by itself; #include "share/grabbag.h" instead. */ 21 | 22 | #ifndef GRABBAG__PICTURE_H 23 | #define GRABBAG__PICTURE_H 24 | 25 | #include "FLAC/metadata.h" 26 | 27 | #ifdef __cplusplus 28 | extern "C" { 29 | #endif 30 | 31 | /* spec should be of the form "[TYPE]|MIME_TYPE|[DESCRIPTION]|[WIDTHxHEIGHTxDEPTH[/COLORS]]|FILE", e.g. 32 | * "|image/jpeg|||cover.jpg" 33 | * "4|image/jpeg||300x300x24|backcover.jpg" 34 | * "|image/png|description|300x300x24/71|cover.png" 35 | * "-->|image/gif||300x300x24/71|http://blah.blah.blah/cover.gif" 36 | * 37 | * empty type means default to FLAC__STREAM_METADATA_PICTURE_TYPE_FRONT_COVER 38 | * empty resolution spec means to get from the file (cannot get used with "-->" linked images) 39 | * spec and error_message must not be NULL 40 | */ 41 | FLAC__StreamMetadata *grabbag__picture_parse_specification(const char *spec, const char **error_message); 42 | 43 | typedef struct PictureResolution 44 | { uint32_t width, height, depth, colors ; 45 | } PictureResolution ; 46 | 47 | FLAC__StreamMetadata *grabbag__picture_from_specification(int type, const char *mime_type, const char * description, 48 | const PictureResolution * res, const char * filepath, const char **error_message); 49 | 50 | #ifdef __cplusplus 51 | } 52 | #endif 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /components/libFLAC/include/share/grabbag/seektable.h: -------------------------------------------------------------------------------- 1 | /* grabbag - Convenience lib for various routines common to several tools 2 | * Copyright (C) 2002-2009 Josh Coalson 3 | * Copyright (C) 2011-2022 Xiph.Org Foundation 4 | * 5 | * This library is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 2.1 of the License, or (at your option) any later version. 9 | * 10 | * This library is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public 16 | * License along with this library; if not, write to the Free Software 17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 18 | */ 19 | 20 | /* Convenience routines for working with seek tables */ 21 | 22 | /* This .h cannot be included by itself; #include "share/grabbag.h" instead. */ 23 | 24 | #ifndef GRABAG__SEEKTABLE_H 25 | #define GRABAG__SEEKTABLE_H 26 | 27 | #include "FLAC/format.h" 28 | 29 | #ifdef __cplusplus 30 | extern "C" { 31 | #endif 32 | 33 | FLAC__bool grabbag__seektable_convert_specification_to_template(const char *spec, FLAC__bool only_explicit_placeholders, FLAC__uint64 total_samples_to_encode, uint32_t sample_rate, FLAC__StreamMetadata *seektable_template, FLAC__bool *spec_has_real_points); 34 | 35 | #ifdef __cplusplus 36 | } 37 | #endif 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /components/libFLAC/include/share/macros.h: -------------------------------------------------------------------------------- 1 | /* libFLAC - Free Lossless Audio Codec library 2 | * Copyright (C) 2013-2022 Xiph.Org Foundation 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions 6 | * are met: 7 | * 8 | * - Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 11 | * - Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 15 | * - Neither the name of the Xiph.org Foundation nor the names of its 16 | * contributors may be used to endorse or promote products derived from 17 | * this software without specific prior written permission. 18 | * 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 22 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR 23 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 24 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 25 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 26 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 27 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 28 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 29 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | */ 31 | 32 | #include 33 | 34 | /* FLAC_CHECK_RETURN : Check the return value of the provided function and 35 | * print an error message if it fails (ie returns a value < 0). 36 | * 37 | * Ideally, a library should not print anything, but this macro is only used 38 | * for things that extremely unlikely to fail, like `chown` to a previoulsy 39 | * saved `uid`. 40 | */ 41 | 42 | #define FLAC_CHECK_RETURN(x) \ 43 | { if ((x) < 0) \ 44 | fprintf (stderr, "%s : %s\n", #x, strerror (errno)) ; \ 45 | } 46 | -------------------------------------------------------------------------------- /components/libFLAC/include/share/replaygain_synthesis.h: -------------------------------------------------------------------------------- 1 | /* replaygain_synthesis - Routines for applying ReplayGain to a signal 2 | * Copyright (C) 2002-2009 Josh Coalson 3 | * Copyright (C) 2011-2022 Xiph.Org Foundation 4 | * 5 | * This library is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 2.1 of the License, or (at your option) any later version. 9 | * 10 | * This library is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public 16 | * License along with this library; if not, write to the Free Software 17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 18 | */ 19 | 20 | #ifndef FLAC__SHARE__REPLAYGAIN_SYNTHESIS_H 21 | #define FLAC__SHARE__REPLAYGAIN_SYNTHESIS_H 22 | 23 | #include /* for size_t */ 24 | #include "FLAC/format.h" 25 | 26 | #define FLAC_SHARE__MAX_SUPPORTED_CHANNELS FLAC__MAX_CHANNELS 27 | 28 | typedef enum { 29 | NOISE_SHAPING_NONE = 0, 30 | NOISE_SHAPING_LOW = 1, 31 | NOISE_SHAPING_MEDIUM = 2, 32 | NOISE_SHAPING_HIGH = 3 33 | } NoiseShaping; 34 | 35 | typedef struct { 36 | const float* FilterCoeff; 37 | FLAC__uint64 Mask; 38 | double Add; 39 | float Dither; 40 | float ErrorHistory [FLAC_SHARE__MAX_SUPPORTED_CHANNELS] [16]; /* 16th order Noise shaping */ 41 | float DitherHistory [FLAC_SHARE__MAX_SUPPORTED_CHANNELS] [16]; 42 | int LastRandomNumber [FLAC_SHARE__MAX_SUPPORTED_CHANNELS]; 43 | unsigned LastHistoryIndex; 44 | NoiseShaping ShapingType; 45 | } DitherContext; 46 | 47 | void FLAC__replaygain_synthesis__init_dither_context(DitherContext *dither, int bits, int shapingtype); 48 | 49 | /* scale = (float) pow(10., (double)replaygain * 0.05); */ 50 | size_t FLAC__replaygain_synthesis__apply_gain(FLAC__byte *data_out, FLAC__bool little_endian_data_out, FLAC__bool unsigned_data_out, const FLAC__int32 * const input[], uint32_t wide_samples, uint32_t channels, const uint32_t source_bps, const uint32_t target_bps, const double scale, const FLAC__bool hard_limit, FLAC__bool do_dithering, DitherContext *dither_context); 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /components/libFLAC/include/share/utf8.h: -------------------------------------------------------------------------------- 1 | #ifndef SHARE__UTF8_H 2 | #define SHARE__UTF8_H 3 | 4 | /* 5 | * Convert a string between UTF-8 and the locale's charset. 6 | * Invalid bytes are replaced by '#', and characters that are 7 | * not available in the target encoding are replaced by '?'. 8 | * 9 | * If the locale's charset is not set explicitly then it is 10 | * obtained using nl_langinfo(CODESET), where available, the 11 | * environment variable CHARSET, or assumed to be US-ASCII. 12 | * 13 | * Return value of conversion functions: 14 | * 15 | * -1 : memory allocation failed 16 | * 0 : data was converted exactly 17 | * 1 : valid data was converted approximately (using '?') 18 | * 2 : input was invalid (but still converted, using '#') 19 | * 3 : unknown encoding (but still converted, using '?') 20 | */ 21 | 22 | int utf8_encode(const char *from, char **to); 23 | int utf8_decode(const char *from, char **to); 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /components/libFLAC/ogg_mapping.c: -------------------------------------------------------------------------------- 1 | /* libFLAC - Free Lossless Audio Codec 2 | * Copyright (C) 2004-2009 Josh Coalson 3 | * Copyright (C) 2011-2022 Xiph.Org Foundation 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 9 | * - Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 12 | * - Redistributions in binary form must reproduce the above copyright 13 | * notice, this list of conditions and the following disclaimer in the 14 | * documentation and/or other materials provided with the distribution. 15 | * 16 | * - Neither the name of the Xiph.org Foundation nor the names of its 17 | * contributors may be used to endorse or promote products derived from 18 | * this software without specific prior written permission. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR 24 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 25 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 26 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 27 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 28 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 29 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 30 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | */ 32 | 33 | #ifdef HAVE_CONFIG_H 34 | # include 35 | #endif 36 | 37 | #include "private/ogg_mapping.h" 38 | 39 | const uint32_t FLAC__OGG_MAPPING_PACKET_TYPE_LEN = 8; /* bits */ 40 | 41 | const FLAC__byte FLAC__OGG_MAPPING_FIRST_HEADER_PACKET_TYPE = 0x7f; 42 | 43 | const FLAC__byte * const FLAC__OGG_MAPPING_MAGIC = (const FLAC__byte * const)"FLAC"; 44 | 45 | const uint32_t FLAC__OGG_MAPPING_VERSION_MAJOR_LEN = 8; /* bits */ 46 | const uint32_t FLAC__OGG_MAPPING_VERSION_MINOR_LEN = 8; /* bits */ 47 | 48 | const uint32_t FLAC__OGG_MAPPING_NUM_HEADERS_LEN = 16; /* bits */ 49 | -------------------------------------------------------------------------------- /components/libhelix-aac/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | idf_component_register(SRC_DIRS . INCLUDE_DIRS .) 2 | target_compile_options(${COMPONENT_LIB} PRIVATE -O3 -Wno-error=unused-label -Wno-error=return-type -Wno-error=missing-braces -Wno-error=pointer-sign -Wno-error=parentheses -Wno-implicit-fallthrough -Wno-stringop-overflow) 3 | target_compile_definitions(${COMPONENT_LIB} PUBLIC -DHELIX_FEATURE_AUDIO_CODEC_AAC_SBR=1) 4 | -------------------------------------------------------------------------------- /components/libhelix-aac/component.mk: -------------------------------------------------------------------------------- 1 | # 2 | # Main Makefile. This is basically the same as a component makefile. 3 | # 4 | # This Makefile should, at the very least, just include $(SDK_PATH)/make/component_common.mk. By default, 5 | # this will take the sources in the src/ directory, compile them and link them into 6 | # lib(subdirectory_name).a in the build directory. This behaviour is entirely configurable, 7 | # please read the ESP-IDF documents if you need to do this. 8 | # 9 | 10 | COMPONENT_SRCDIRS := . 11 | COMPONENT_ADD_INCLUDEDIRS += . 12 | CFLAGS += -O3 -Wno-error=unused-label -Wno-error=return-type -Wno-error=missing-braces -Wno-error=pointer-sign -Wno-error=parentheses -Wno-implicit-fallthrough 13 | CPPFLAGS += -DHELIX_FEATURE_AUDIO_CODEC_AAC_SBR=1 -Dmalloc=my_malloc -Drealloc=my_realloc 14 | -------------------------------------------------------------------------------- /components/libhelix-aac/readme.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alxvasilev/net-player-esp32/e1367196c69028665ef950d16815a7b6aae4aeff/components/libhelix-aac/readme.txt -------------------------------------------------------------------------------- /components/libmad/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | idf_component_register(SRC_DIRS . INCLUDE_DIRS .) 2 | target_compile_options(${COMPONENT_LIB} PRIVATE -O3 3 | -Wno-error=unused-label -Wno-error=return-type -Wno-error=missing-braces -Wno-error=pointer-sign 4 | -Wno-error=parentheses -Wno-implicit-fallthrough -Wno-stringop-overflow -Wno-imcompatible-pointer-types 5 | ) 6 | target_compile_definitions(${COMPONENT_LIB} PRIVATE -D FPM_DEFAULT) 7 | -------------------------------------------------------------------------------- /components/libmad/COPYRIGHT: -------------------------------------------------------------------------------- 1 | 2 | libmad - MPEG audio decoder library 3 | Copyright (C) 2000-2004 Underbit Technologies, Inc. 4 | 5 | This program is free software; you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 2 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | 19 | If you would like to negotiate alternate licensing terms, you may do 20 | so by contacting: Underbit Technologies, Inc. 21 | 22 | -------------------------------------------------------------------------------- /components/libmad/TODO: -------------------------------------------------------------------------------- 1 | 2 | libmad - MPEG audio decoder library 3 | Copyright (C) 2000-2004 Underbit Technologies, Inc. 4 | 5 | $Id: TODO,v 1.3 2004/02/05 09:02:39 rob Exp $ 6 | 7 | =============================================================================== 8 | 9 | libmad: 10 | - more API layers (buffering, PCM samples, dithering, etc.) 11 | - x86 performance optimization compiler flags 12 | - function documentation, general docs 13 | - finish async API 14 | - parse system streams? 15 | - MPEG-2 MC, AAC? 16 | - logarithmic multiplication? 17 | - multiple frame decoding for better locality of reference? 18 | - frame serial numbers, Layer III frame continuity checks 19 | 20 | fixed.h: 21 | - experiment with FPM_INTEL: 22 | 23 | # if 1 24 | # define mad_f_scale64(hi, lo) \ 25 | ({ mad_fixed_t __result; \ 26 | asm ("shrl %3,%1\n\t" \ 27 | "shll %4,%2\n\t" \ 28 | "orl %2,%1" \ 29 | : "=rm" (__result) \ 30 | : "0" (lo), "r" (hi), \ 31 | "I" (MAD_F_SCALEBITS), "I" (32 - MAD_F_SCALEBITS) \ 32 | : "cc"); \ 33 | __result; \ 34 | }) 35 | # else 36 | # define mad_f_scale64(hi, lo) \ 37 | ({ mad_fixed64hi_t __hi_; \ 38 | mad_fixed64lo_t __lo_; \ 39 | mad_fixed_t __result; \ 40 | asm ("sall %2,%1" \ 41 | : "=r" (__hi_) \ 42 | : "0" (hi), "I" (32 - MAD_F_SCALEBITS) \ 43 | : "cc"); \ 44 | asm ("shrl %2,%1" \ 45 | : "=r" (__lo_) \ 46 | : "0" (lo), "I" (MAD_F_SCALEBITS) \ 47 | : "cc"); \ 48 | asm ("orl %1,%2" \ 49 | : "=rm" (__result) \ 50 | : "r" (__hi_), "0" (__lo_) \ 51 | : "cc"); \ 52 | __result; \ 53 | }) 54 | # endif 55 | 56 | libmad Layer I: 57 | - check frame length sanity 58 | 59 | libmad Layer II: 60 | - check frame length sanity 61 | 62 | libmad Layer III: 63 | - circular buffer 64 | - optimize zero_part from Huffman decoding throughout 65 | - MPEG 2.5 8000 Hz sf bands? mixed blocks? 66 | - stereo->mono conversion optimization? 67 | - enable frame-at-a-time decoding 68 | - improve portability of huffman.c 69 | 70 | -------------------------------------------------------------------------------- /components/libmad/VERSION: -------------------------------------------------------------------------------- 1 | 0.15.1b 2 | configure.ac:24 3 | version.h:25-28 4 | msvc++/config.h:99,105,120 5 | msvc++/mad.h:41-44 6 | 7 | Makefile.am:98-100 8 | -------------------------------------------------------------------------------- /components/libmad/bit.h: -------------------------------------------------------------------------------- 1 | /* 2 | * libmad - MPEG audio decoder library 3 | * Copyright (C) 2000-2004 Underbit Technologies, Inc. 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | * 19 | * $Id: bit.h,v 1.12 2004/01/23 09:41:32 rob Exp $ 20 | */ 21 | 22 | # ifndef LIBMAD_BIT_H 23 | # define LIBMAD_BIT_H 24 | 25 | struct mad_bitptr { 26 | unsigned char const *byte; 27 | unsigned short cache; 28 | unsigned short left; 29 | }; 30 | 31 | void mad_bit_init(struct mad_bitptr *, unsigned char const *); 32 | 33 | # define mad_bit_finish(bitptr) /* nothing */ 34 | 35 | unsigned int mad_bit_length(struct mad_bitptr const *, 36 | struct mad_bitptr const *); 37 | 38 | # define mad_bit_bitsleft(bitptr) ((bitptr)->left) 39 | unsigned char const *mad_bit_nextbyte(struct mad_bitptr const *); 40 | 41 | void mad_bit_skip(struct mad_bitptr *, unsigned int); 42 | unsigned long mad_bit_read(struct mad_bitptr *, unsigned int); 43 | void mad_bit_write(struct mad_bitptr *, unsigned int, unsigned long); 44 | 45 | unsigned short mad_bit_crc(struct mad_bitptr, unsigned int, unsigned short); 46 | 47 | # endif 48 | -------------------------------------------------------------------------------- /components/libmad/component.mk: -------------------------------------------------------------------------------- 1 | # 2 | # Main Makefile. This is basically the same as a component makefile. 3 | # 4 | # This Makefile should, at the very least, just include $(SDK_PATH)/make/component_common.mk. By default, 5 | # this will take the sources in the src/ directory, compile them and link them into 6 | # lib(subdirectory_name).a in the build directory. This behaviour is entirely configurable, 7 | # please read the ESP-IDF documents if you need to do this. 8 | # 9 | 10 | COMPONENT_SRCDIRS := . 11 | COMPONENT_ADD_INCLUDEDIRS += . include 12 | CFLAGS += -Wno-error=unused-label -Wno-error=return-type -Wno-error=missing-braces -Wno-error=pointer-sign -Wno-error=parentheses -Wno-implicit-fallthrough 13 | 14 | -------------------------------------------------------------------------------- /components/libmad/fixed.c: -------------------------------------------------------------------------------- 1 | /* 2 | * libmad - MPEG audio decoder library 3 | * Copyright (C) 2000-2004 Underbit Technologies, Inc. 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | * 19 | * $Id: fixed.c,v 1.13 2004/01/23 09:41:32 rob Exp $ 20 | */ 21 | 22 | # ifdef HAVE_CONFIG_H 23 | # include "config.h" 24 | # endif 25 | 26 | # include "global.h" 27 | 28 | # include "fixed.h" 29 | 30 | /* 31 | * NAME: fixed->abs() 32 | * DESCRIPTION: return absolute value of a fixed-point number 33 | */ 34 | mad_fixed_t mad_f_abs(mad_fixed_t x) 35 | { 36 | return x < 0 ? -x : x; 37 | } 38 | 39 | /* 40 | * NAME: fixed->div() 41 | * DESCRIPTION: perform division using fixed-point math 42 | */ 43 | mad_fixed_t mad_f_div(mad_fixed_t x, mad_fixed_t y) 44 | { 45 | mad_fixed_t q, r; 46 | unsigned int bits; 47 | 48 | q = mad_f_abs(x / y); 49 | 50 | if (x < 0) { 51 | x = -x; 52 | y = -y; 53 | } 54 | 55 | r = x % y; 56 | 57 | if (y < 0) { 58 | x = -x; 59 | y = -y; 60 | } 61 | 62 | if (q > mad_f_intpart(MAD_F_MAX) && 63 | !(q == -mad_f_intpart(MAD_F_MIN) && r == 0 && (x < 0) != (y < 0))) 64 | return 0; 65 | 66 | for (bits = MAD_F_FRACBITS; bits && r; --bits) { 67 | q <<= 1, r <<= 1; 68 | if (r >= y) 69 | r -= y, ++q; 70 | } 71 | 72 | /* round */ 73 | if (2 * r >= y) 74 | ++q; 75 | 76 | /* fix sign */ 77 | if ((x < 0) != (y < 0)) 78 | q = -q; 79 | 80 | return q << bits; 81 | } 82 | -------------------------------------------------------------------------------- /components/libmad/global.h: -------------------------------------------------------------------------------- 1 | /* 2 | * libmad - MPEG audio decoder library 3 | * Copyright (C) 2000-2004 Underbit Technologies, Inc. 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | * 19 | * $Id: global.h,v 1.11 2004/01/23 09:41:32 rob Exp $ 20 | */ 21 | 22 | # ifndef LIBMAD_GLOBAL_H 23 | # define LIBMAD_GLOBAL_H 24 | 25 | /* conditional debugging */ 26 | 27 | # if defined(DEBUG) && defined(NDEBUG) 28 | # error "cannot define both DEBUG and NDEBUG" 29 | # endif 30 | 31 | # if defined(DEBUG) 32 | # include 33 | # endif 34 | 35 | /* conditional features */ 36 | 37 | # if defined(OPT_SPEED) && defined(OPT_ACCURACY) 38 | # error "cannot optimize for both speed and accuracy" 39 | # endif 40 | 41 | # if defined(OPT_SPEED) && !defined(OPT_SSO) 42 | # define OPT_SSO 43 | # endif 44 | 45 | # if defined(HAVE_UNISTD_H) && defined(HAVE_WAITPID) && \ 46 | defined(HAVE_FCNTL) && defined(HAVE_PIPE) && defined(HAVE_FORK) 47 | # define USE_ASYNC 48 | # endif 49 | 50 | # if !defined(HAVE_ASSERT_H) 51 | # if defined(NDEBUG) 52 | # define assert(x) /* nothing */ 53 | # else 54 | # define assert(x) do { if (!(x)) abort(); } while (0) 55 | # endif 56 | # endif 57 | 58 | # endif 59 | -------------------------------------------------------------------------------- /components/libmad/huffman.h: -------------------------------------------------------------------------------- 1 | /* 2 | * libmad - MPEG audio decoder library 3 | * Copyright (C) 2000-2004 Underbit Technologies, Inc. 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | * 19 | * $Id: huffman.h,v 1.11 2004/01/23 09:41:32 rob Exp $ 20 | */ 21 | 22 | # ifndef LIBMAD_HUFFMAN_H 23 | # define LIBMAD_HUFFMAN_H 24 | 25 | union huffquad { 26 | struct { 27 | unsigned short final : 1; 28 | unsigned short bits : 3; 29 | unsigned short offset : 12; 30 | } ptr; 31 | struct { 32 | unsigned short final : 1; 33 | unsigned short hlen : 3; 34 | unsigned short v : 1; 35 | unsigned short w : 1; 36 | unsigned short x : 1; 37 | unsigned short y : 1; 38 | } value; 39 | unsigned short final : 1; 40 | }; 41 | 42 | union huffpair { 43 | struct { 44 | unsigned short final : 1; 45 | unsigned short bits : 3; 46 | unsigned short offset : 12; 47 | } ptr; 48 | struct { 49 | unsigned short final : 1; 50 | unsigned short hlen : 3; 51 | unsigned short x : 4; 52 | unsigned short y : 4; 53 | } value; 54 | unsigned short final : 1; 55 | }; 56 | 57 | struct hufftable { 58 | union huffpair const *table; 59 | unsigned short linbits; 60 | unsigned short startbits; 61 | }; 62 | 63 | extern union huffquad const *const mad_huff_quad_table[2]; 64 | extern struct hufftable const mad_huff_pair_table[32]; 65 | 66 | # endif 67 | -------------------------------------------------------------------------------- /components/libmad/layer12.h: -------------------------------------------------------------------------------- 1 | /* 2 | * libmad - MPEG audio decoder library 3 | * Copyright (C) 2000-2004 Underbit Technologies, Inc. 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | * 19 | * $Id: layer12.h,v 1.10 2004/01/23 09:41:32 rob Exp $ 20 | */ 21 | 22 | # ifndef LIBMAD_LAYER12_H 23 | # define LIBMAD_LAYER12_H 24 | 25 | # include "stream.h" 26 | # include "frame.h" 27 | 28 | int mad_layer_I(struct mad_stream *, struct mad_frame *); 29 | int mad_layer_II(struct mad_stream *, struct mad_frame *); 30 | 31 | # endif 32 | -------------------------------------------------------------------------------- /components/libmad/layer3.h: -------------------------------------------------------------------------------- 1 | /* 2 | * libmad - MPEG audio decoder library 3 | * Copyright (C) 2000-2004 Underbit Technologies, Inc. 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | * 19 | * $Id: layer3.h,v 1.10 2004/01/23 09:41:32 rob Exp $ 20 | */ 21 | 22 | # ifndef LIBMAD_LAYER3_H 23 | # define LIBMAD_LAYER3_H 24 | 25 | # include "stream.h" 26 | # include "frame.h" 27 | 28 | int mad_layer_III(struct mad_stream *, struct mad_frame *); 29 | 30 | # endif 31 | -------------------------------------------------------------------------------- /components/libmad/libmad.list.in: -------------------------------------------------------------------------------- 1 | # @configure_input@ 2 | 3 | # Directories... 4 | $prefix=@prefix@ 5 | $exec_prefix=@exec_prefix@ 6 | $srcdir=@srcdir@ 7 | 8 | # Product information 9 | %product @PACKAGE@ 10 | %copyright GPL 11 | %vendor Underbit Technologies, Inc. 12 | %license @srcdir@/COPYING 13 | %readme @srcdir@/README 14 | %description libmad is an MPEG audio decoder library. 15 | %version @VERSION@ 16 | %packager Giuseppe "Cowo" Corbelli 17 | 18 | %system all 19 | f 0755 root root @libdir@/libmad.la .libs/libmad.lai 20 | f 0644 root root @libdir@/libmad.a .libs/libmad.a 21 | f 0644 root root @includedir@/mad.h mad.h 22 | -------------------------------------------------------------------------------- /components/libmad/mad.h.sed: -------------------------------------------------------------------------------- 1 | # 2 | # libmad - MPEG audio decoder library 3 | # Copyright (C) 2000-2004 Underbit Technologies, Inc. 4 | # 5 | # This program is free software; you can redistribute it and/or modify 6 | # it under the terms of the GNU General Public License as published by 7 | # the Free Software Foundation; either version 2 of the License, or 8 | # (at your option) any later version. 9 | # 10 | # This program is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | # GNU General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU General Public License 16 | # along with this program; if not, write to the Free Software 17 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | # 19 | # $Id: mad.h.sed,v 1.9 2004/01/23 09:41:32 rob Exp $ 20 | # 21 | 22 | /^\/\*$/{ 23 | N 24 | s/ \* libmad - /&/ 25 | t copy 26 | b next 27 | : copy 28 | g 29 | n 30 | s|^ \* \$\(Id: .*\) \$$|/* \1 */|p 31 | /^ \*\/$/d 32 | b copy 33 | } 34 | /^# *include "/d 35 | : next 36 | p 37 | -------------------------------------------------------------------------------- /components/libmad/synth.h: -------------------------------------------------------------------------------- 1 | /* 2 | * libmad - MPEG audio decoder library 3 | * Copyright (C) 2000-2004 Underbit Technologies, Inc. 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | * 19 | * $Id: synth.h,v 1.15 2004/01/23 09:41:33 rob Exp $ 20 | */ 21 | 22 | # ifndef LIBMAD_SYNTH_H 23 | # define LIBMAD_SYNTH_H 24 | 25 | # include "fixed.h" 26 | # include "frame.h" 27 | 28 | struct mad_pcm { 29 | unsigned int samplerate; /* sampling frequency (Hz) */ 30 | unsigned short channels; /* number of channels */ 31 | unsigned short length; /* number of samples per channel */ 32 | mad_fixed_t samples[2][1152]; /* PCM output samples [ch][sample] */ 33 | }; 34 | 35 | struct mad_synth { 36 | mad_fixed_t filter[2][2][2][16][8]; /* polyphase filterbank outputs */ 37 | /* [ch][eo][peo][s][v] */ 38 | 39 | unsigned int phase; /* current processing phase */ 40 | 41 | struct mad_pcm pcm; /* PCM output */ 42 | }; 43 | 44 | /* single channel PCM selector */ 45 | enum { 46 | MAD_PCM_CHANNEL_SINGLE = 0 47 | }; 48 | 49 | /* dual channel PCM selector */ 50 | enum { 51 | MAD_PCM_CHANNEL_DUAL_1 = 0, 52 | MAD_PCM_CHANNEL_DUAL_2 = 1 53 | }; 54 | 55 | /* stereo PCM selector */ 56 | enum { 57 | MAD_PCM_CHANNEL_STEREO_LEFT = 0, 58 | MAD_PCM_CHANNEL_STEREO_RIGHT = 1 59 | }; 60 | 61 | void mad_synth_init(struct mad_synth *); 62 | 63 | # define mad_synth_finish(synth) /* nothing */ 64 | 65 | void mad_synth_mute(struct mad_synth *); 66 | 67 | void mad_synth_frame(struct mad_synth *, struct mad_frame const *); 68 | 69 | # endif 70 | -------------------------------------------------------------------------------- /components/libmad/version.h: -------------------------------------------------------------------------------- 1 | /* 2 | * libmad - MPEG audio decoder library 3 | * Copyright (C) 2000-2004 Underbit Technologies, Inc. 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | * 19 | * $Id: version.h,v 1.26 2004/01/23 09:41:33 rob Exp $ 20 | */ 21 | 22 | # ifndef LIBMAD_VERSION_H 23 | # define LIBMAD_VERSION_H 24 | 25 | # define MAD_VERSION_MAJOR 0 26 | # define MAD_VERSION_MINOR 15 27 | # define MAD_VERSION_PATCH 1 28 | # define MAD_VERSION_EXTRA " (beta)" 29 | 30 | # define MAD_VERSION_STRINGIZE(str) #str 31 | # define MAD_VERSION_STRING(num) MAD_VERSION_STRINGIZE(num) 32 | 33 | # define MAD_VERSION MAD_VERSION_STRING(MAD_VERSION_MAJOR) "." \ 34 | MAD_VERSION_STRING(MAD_VERSION_MINOR) "." \ 35 | MAD_VERSION_STRING(MAD_VERSION_PATCH) \ 36 | MAD_VERSION_EXTRA 37 | 38 | # define MAD_PUBLISHYEAR "2000-2004" 39 | # define MAD_AUTHOR "Underbit Technologies, Inc." 40 | # define MAD_EMAIL "info@underbit.com" 41 | 42 | extern char const mad_version[]; 43 | extern char const mad_copyright[]; 44 | extern char const mad_author[]; 45 | extern char const mad_build[]; 46 | 47 | # endif 48 | -------------------------------------------------------------------------------- /components/libogg/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | idf_component_register(SRC_DIRS . INCLUDE_DIRS . include) 2 | target_compile_options(${COMPONENT_LIB} PRIVATE -O3) 3 | target_compile_definitions(${COMPONENT_LIB} PUBLIC -DNDEBUG=1) 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /components/libogg/Makefile.am: -------------------------------------------------------------------------------- 1 | ## Process this file with automake to produce Makefile.in 2 | 3 | AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include 4 | 5 | lib_LTLIBRARIES = libogg.la 6 | 7 | libogg_la_SOURCES = framing.c bitwise.c crctable.h 8 | libogg_la_LDFLAGS = -no-undefined -version-info @LIB_CURRENT@:@LIB_REVISION@:@LIB_AGE@ 9 | 10 | # build and run the self tests on 'make check' 11 | 12 | noinst_PROGRAMS = test_bitwise test_framing 13 | 14 | test_bitwise_SOURCES = bitwise.c 15 | test_bitwise_CFLAGS = -D_V_SELFTEST 16 | 17 | test_framing_SOURCES = framing.c crctable.h 18 | test_framing_CFLAGS = -D_V_SELFTEST 19 | 20 | check: $(noinst_PROGRAMS) 21 | ./test_bitwise$(EXEEXT) 22 | ./test_framing$(EXEEXT) 23 | 24 | debug: 25 | $(MAKE) all CFLAGS="@DEBUG@" 26 | 27 | profile: 28 | $(MAKE) all CFLAGS="@PROFILE@" 29 | -------------------------------------------------------------------------------- /components/libogg/component.mk: -------------------------------------------------------------------------------- 1 | COMPONENT_SRCDIRS := . 2 | COMPONENT_ADD_INCLUDEDIRS += . ./include 3 | CFLAGS += -O3 4 | CPPFLAGS += -DNDEBUG -Dmalloc=my_malloc -Drealloc=my_realloc -Dcalloc=my_calloc 5 | -------------------------------------------------------------------------------- /components/libogg/include/Makefile.am: -------------------------------------------------------------------------------- 1 | ## Process this file with automake to produce Makefile.in 2 | 3 | SUBDIRS = ogg 4 | -------------------------------------------------------------------------------- /components/libogg/include/ogg/Makefile.am: -------------------------------------------------------------------------------- 1 | ## Process this file with automake to produce Makefile.in 2 | 3 | oggincludedir = $(includedir)/ogg 4 | 5 | ogginclude_HEADERS = ogg.h os_types.h 6 | nodist_ogginclude_HEADERS = config_types.h 7 | -------------------------------------------------------------------------------- /components/libogg/include/ogg/config_types.h: -------------------------------------------------------------------------------- 1 | #ifndef __CONFIG_TYPES_H__ 2 | #define __CONFIG_TYPES_H__ 3 | 4 | /* these are filled in by configure or cmake*/ 5 | #define INCLUDE_INTTYPES_H 1 6 | #define INCLUDE_STDINT_H 1 7 | #define INCLUDE_SYS_TYPES_H 1 8 | 9 | #if INCLUDE_INTTYPES_H 10 | # include 11 | #endif 12 | #if INCLUDE_STDINT_H 13 | # include 14 | #endif 15 | #if INCLUDE_SYS_TYPES_H 16 | # include 17 | #endif 18 | 19 | typedef int16_t ogg_int16_t; 20 | typedef uint16_t ogg_uint16_t; 21 | typedef int32_t ogg_int32_t; 22 | typedef uint32_t ogg_uint32_t; 23 | typedef int64_t ogg_int64_t; 24 | typedef uint64_t ogg_uint64_t; 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /components/libogg/include/ogg/config_types.h.in: -------------------------------------------------------------------------------- 1 | #ifndef __CONFIG_TYPES_H__ 2 | #define __CONFIG_TYPES_H__ 3 | 4 | /* these are filled in by configure or cmake*/ 5 | #define INCLUDE_INTTYPES_H @INCLUDE_INTTYPES_H@ 6 | #define INCLUDE_STDINT_H @INCLUDE_STDINT_H@ 7 | #define INCLUDE_SYS_TYPES_H @INCLUDE_SYS_TYPES_H@ 8 | 9 | #if INCLUDE_INTTYPES_H 10 | # include 11 | #endif 12 | #if INCLUDE_STDINT_H 13 | # include 14 | #endif 15 | #if INCLUDE_SYS_TYPES_H 16 | # include 17 | #endif 18 | 19 | typedef @SIZE16@ ogg_int16_t; 20 | typedef @USIZE16@ ogg_uint16_t; 21 | typedef @SIZE32@ ogg_int32_t; 22 | typedef @USIZE32@ ogg_uint32_t; 23 | typedef @SIZE64@ ogg_int64_t; 24 | typedef @USIZE64@ ogg_uint64_t; 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /components/mySystem: -------------------------------------------------------------------------------- 1 | ../esp32-mylibs/mySystem -------------------------------------------------------------------------------- /components/myeq/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | idf_component_register(SRC_DIRS . INCLUDE_DIRS .) 2 | target_compile_options(${COMPONENT_LIB} PRIVATE -O3 -std=gnu++17) 3 | -------------------------------------------------------------------------------- /components/myeq/component.mk: -------------------------------------------------------------------------------- 1 | COMPONENT_SRCDIRS := . 2 | COMPONENT_ADD_INCLUDEDIRS += . 3 | CXXFLAGS += -O3 -std=gnu++17 4 | CFLAGS += -O3 5 | -------------------------------------------------------------------------------- /components/myeq/equalizer.cpp: -------------------------------------------------------------------------------- 1 | #include "equalizer.hpp" 2 | const EqBandConfig EqBandConfig::kPreset10Band[10] = { 3 | {31, 1000}, {62, 1000}, {125, 1000}, {250, 1000}, {500, 1000}, 4 | {1000, 1000}, {2000, 1000}, {4000, 1000}, {8000, 1000}, {15500, 1000} 5 | }; 6 | 7 | const EqBandConfig EqBandConfig::kPreset9Band[9] = { 8 | {31, 1000}, {62, 707}, {125, 707}, {250, 707}, {500, 707}, 9 | {1500, 1500}, {4000, 707}, {8000, 707}, {15500, 707} 10 | }; 11 | 12 | const EqBandConfig EqBandConfig::kPreset8Band[8] = { 13 | {45, 1000}, {250, 350}, {500, 707}, {350, 707}, {2000, 707}, 14 | {4000, 707}, {8000, 707}, {15500, 707} 15 | }; 16 | 17 | const EqBandConfig EqBandConfig::kPreset7Band[7] = { 18 | {50, 1000}, {200, 350}, {750, 350}, {1600, 350}, {4000, 707}, {8000, 707}, {15500, 707} 19 | }; 20 | 21 | const EqBandConfig EqBandConfig::kPreset6Band[6] = { 22 | {50, 1000}, {200, 350}, {1000, 300}, {3000, 350}, {8000, 707}, {15500, 707} 23 | }; 24 | 25 | const EqBandConfig EqBandConfig::kPreset5Band[5] = { 26 | {55, 1000}, {200, 350}, {3000, 300}, {7000, 300}, {15000, 10} 27 | }; 28 | const EqBandConfig EqBandConfig::kPreset4Band[4] = { 29 | {55, 1000}, {1000, 200}, {4000, 200}, {15000, 707} 30 | }; 31 | const EqBandConfig EqBandConfig::kPreset3Band[3] = { 32 | {55, 1000}, {4000, 100}, {15000, 707} 33 | }; 34 | const EqBandConfig* EqBandConfig::kBandPresets[8] = { 35 | EqBandConfig::kPreset3Band, EqBandConfig::kPreset4Band, EqBandConfig::kPreset5Band, 36 | EqBandConfig::kPreset6Band, EqBandConfig::kPreset7Band, EqBandConfig::kPreset8Band, 37 | EqBandConfig::kPreset9Band, EqBandConfig::kPreset10Band 38 | }; 39 | -------------------------------------------------------------------------------- /components/st7735: -------------------------------------------------------------------------------- 1 | ../esp32-mylibs/st7735 -------------------------------------------------------------------------------- /components/tinyxml/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | idf_component_register(SRC_DIRS . INCLUDE_DIRS .) 2 | -------------------------------------------------------------------------------- /components/tinyxml/component.mk: -------------------------------------------------------------------------------- 1 | # 2 | # Main Makefile. This is basically the same as a component makefile. 3 | # 4 | # This Makefile should, at the very least, just include $(SDK_PATH)/make/component_common.mk. By default, 5 | # this will take the sources in the src/ directory, compile them and link them into 6 | # lib(subdirectory_name).a in the build directory. This behaviour is entirely configurable, 7 | # please read the ESP-IDF documents if you need to do this. 8 | # 9 | 10 | COMPONENT_SRCDIRS := . 11 | COMPONENT_ADD_INCLUDEDIRS += . 12 | 13 | -------------------------------------------------------------------------------- /components/tremor/CHANGELOG: -------------------------------------------------------------------------------- 1 | *** 20020517: 1.0.2 *** 2 | 3 | Playback bugfix to floor1; mode mistakenly used for sizing instead 4 | of blockflag 5 | 6 | *** 20020515: 1.0.1 *** 7 | 8 | Added complete API documentation to source tarball. No code 9 | changes. 10 | 11 | *** 20020412: 1.0.1 *** 12 | 13 | Fixed a clipping bug that affected ARM processors; negative 14 | overflows were being properly clipped, but then clobbered to 15 | positive by the positive overflow chec (asm_arm.h:CLIP_TO_15) 16 | 17 | *** 20020403: 1.0.0 *** 18 | 19 | Initial version -------------------------------------------------------------------------------- /components/tremor/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | idf_component_register(SRC_DIRS . INCLUDE_DIRS . REQUIRES libogg) 2 | target_compile_options(${COMPONENT_LIB} PRIVATE -O3 -std=gnu++17 -Wno-incompatible-pointer-types) 3 | -------------------------------------------------------------------------------- /components/tremor/COPYING: -------------------------------------------------------------------------------- 1 | Copyright (c) 2002, Xiph.org Foundation 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions 5 | are met: 6 | 7 | - Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | 10 | - Redistributions in binary form must reproduce the above copyright 11 | notice, this list of conditions and the following disclaimer in the 12 | documentation and/or other materials provided with the distribution. 13 | 14 | - Neither the name of the Xiph.org Foundation nor the names of its 15 | contributors may be used to endorse or promote products derived from 16 | this software without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION 22 | OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | -------------------------------------------------------------------------------- /components/tremor/Makefile.am: -------------------------------------------------------------------------------- 1 | AUTOMAKE_OPTIONS = foreign 2 | 3 | INCLUDES = -I./ @OGG_CFLAGS@ 4 | 5 | pkgconfigdir = $(libdir)/pkgconfig 6 | pkgconfig_DATA = vorbisidec.pc 7 | 8 | lib_LTLIBRARIES = libvorbisidec.la 9 | 10 | libvorbisidec_la_SOURCES = mdct.c block.c window.c \ 11 | synthesis.c info.c \ 12 | floor1.c floor0.c vorbisfile.c \ 13 | res012.c mapping0.c registry.c codebook.c \ 14 | sharedbook.c \ 15 | codebook.h misc.h mdct_lookup.h\ 16 | os.h mdct.h block.h ivorbisfile.h lsp_lookup.h\ 17 | registry.h window.h window_lookup.h\ 18 | codec_internal.h backends.h \ 19 | asm_arm.h ivorbiscodec.h 20 | libvorbisidec_la_LDFLAGS = -version-info @V_LIB_CURRENT@:@V_LIB_REVISION@:@V_LIB_AGE@ 21 | libvorbisidec_la_LIBADD = @OGG_LIBS@ 22 | 23 | EXTRA_PROGRAMS = ivorbisfile_example iseeking_example 24 | CLEANFILES = $(EXTRA_PROGRAMS) $(lib_LTLIBRARIES) 25 | 26 | ivorbisfile_example_SOURCES = ivorbisfile_example.c 27 | ivorbisfile_example_LDFLAGS = -static 28 | ivorbisfile_example_LDADD = libvorbisidec.la @OGG_LIBS@ 29 | 30 | iseeking_example_SOURCES = iseeking_example.c 31 | iseeking_example_LDFLAGS = -static 32 | iseeking_example_LDADD = libvorbisidec.la @OGG_LIBS@ 33 | 34 | includedir = $(prefix)/include/tremor 35 | 36 | include_HEADERS = ivorbiscodec.h ivorbisfile.h config_types.h 37 | 38 | EXTRA_DIST = vorbisidec.pc.in \ 39 | $(srcdir)/doc/*.html $(srcdir)/win32/VS*/libtremor/*.vcproj 40 | 41 | example: 42 | -ln -fs . vorbis 43 | $(MAKE) ivorbisfile_example 44 | $(MAKE) iseeking_example 45 | 46 | debug: 47 | $(MAKE) all CFLAGS="@DEBUG@" 48 | 49 | profile: 50 | $(MAKE) all CFLAGS="@PROFILE@" 51 | -------------------------------------------------------------------------------- /components/tremor/README: -------------------------------------------------------------------------------- 1 | This README covers the Ogg Vorbis 'Tremor' integer playback codec 2 | source as of date 2002 09 02, version 1.0.0. 3 | 4 | ****** 5 | 6 | The C source in this package will build on any ANSI C compiler and 7 | function completely and properly on any platform. The included build 8 | system assumes GNU build system and make tools (m4, automake, 9 | autoconf, libtool and gmake). GCC is not required, although GCC is 10 | the most tested compiler. To build using GNU tools, type in the 11 | source directory: 12 | 13 | ./autogen.sh 14 | make 15 | 16 | Currently, the source implements playback in pure C on all platforms 17 | except ARM, where a [currently] small amount of assembly (see 18 | asm_arm.h) is used to implement 64 bit math operations and fast LSP 19 | computation. If building on ARM without the benefit of GNU build 20 | system tools, be sure that '_ARM_ASSEM_' is #defined by the build 21 | system if this assembly is desired, else the resulting library will 22 | use whatever 64 bit math builtins the compiler implements. 23 | 24 | No math library is required by this source. No floating point 25 | operations are used at any point in either setup or decode. This 26 | decoder library will properly decode any past, current or future 27 | Vorbis I file or stream. 28 | 29 | ******** 30 | 31 | The build system produces a static and [when supported by the OS] 32 | dynamic library named 'libvorbisidec'. This library exposes an API 33 | nearly identical to the BSD reference library's 'libvorbisfile', 34 | including all the features familiar to users of vorbisfile. This API 35 | is similar enough that the proper header file to include is named 36 | 'ivorbisfile.h' [included in the source build directory]. Lower level 37 | libvorbis-style headers and structures are in 'ivorbiscodec.h' 38 | [included in the source build directory]. A simple example program, 39 | ivorbisfile_example.c, can be built with 'make example'. 40 | 41 | ******** 42 | 43 | Detailed Tremor API Documentation begins at doc/index.html 44 | 45 | Monty 46 | xiph.org 47 | -------------------------------------------------------------------------------- /components/tremor/Version_script.in: -------------------------------------------------------------------------------- 1 | # 2 | # Export file for libvorbisidec 3 | # 4 | # Only the symbols listed in the global section will be callable from 5 | # applications linking to libvorbisidec. 6 | # 7 | 8 | @PACKAGE@.so.1 9 | { 10 | global: 11 | ov_clear; 12 | ov_open; 13 | ov_open_callbacks; 14 | ov_test; 15 | ov_test_callbacks; 16 | ov_test_open; 17 | ov_bitrate; 18 | ov_bitrate_instant; 19 | ov_streams; 20 | ov_seekable; 21 | ov_serialnumber; 22 | ov_raw_total; 23 | ov_pcm_total; 24 | ov_time_total; 25 | ov_raw_seek; 26 | ov_pcm_seek; 27 | ov_pcm_seek_page; 28 | ov_time_seek; 29 | ov_time_seek_page; 30 | ov_raw_tell; 31 | ov_pcm_tell; 32 | ov_time_tell; 33 | ov_info; 34 | ov_comment; 35 | ov_read; 36 | 37 | vorbis_info_init; 38 | vorbis_info_clear; 39 | vorbis_info_blocksize; 40 | vorbis_comment_init; 41 | vorbis_comment_add; 42 | vorbis_comment_add_tag; 43 | vorbis_comment_query; 44 | vorbis_comment_query_count; 45 | vorbis_comment_clear; 46 | vorbis_block_init; 47 | vorbis_block_clear; 48 | vorbis_dsp_clear; 49 | vorbis_synthesis_idheader; 50 | vorbis_synthesis_headerin; 51 | vorbis_synthesis_init; 52 | vorbis_synthesis_restart; 53 | vorbis_synthesis; 54 | vorbis_synthesis_trackonly; 55 | vorbis_synthesis_blockin; 56 | vorbis_synthesis_pcmout; 57 | vorbis_synthesis_read; 58 | vorbis_packet_blocksize; 59 | 60 | local: 61 | *; 62 | }; 63 | -------------------------------------------------------------------------------- /components/tremor/block.h: -------------------------------------------------------------------------------- 1 | /******************************************************************** 2 | * * 3 | * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE. * 4 | * * 5 | * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * 6 | * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * 7 | * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * 8 | * * 9 | * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2008 * 10 | * BY THE Xiph.Org FOUNDATION http://www.xiph.org/ * 11 | * * 12 | ******************************************************************** 13 | 14 | function: shared block functions 15 | 16 | ********************************************************************/ 17 | 18 | #ifndef _V_BLOCK_ 19 | #define _V_BLOCK_ 20 | 21 | extern void _vorbis_block_ripcord(vorbis_block *vb); 22 | extern void *_vorbis_block_alloc(vorbis_block *vb,long bytes); 23 | 24 | #endif 25 | -------------------------------------------------------------------------------- /components/tremor/component.mk: -------------------------------------------------------------------------------- 1 | COMPONENT_SRCDIRS := . 2 | COMPONENT_ADD_INCLUDEDIRS += . 3 | CXXFLAGS += -O3 -std=gnu++17 4 | CFLAGS += -O3 5 | CPPFLAGS=-Dmalloc=my_malloc -Drealloc=my_realloc -Dcalloc=my_calloc 6 | -------------------------------------------------------------------------------- /components/tremor/config_types.h: -------------------------------------------------------------------------------- 1 | /******************************************************************** 2 | * * 3 | * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE. * 4 | * * 5 | * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * 6 | * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * 7 | * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * 8 | * * 9 | * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002 * 10 | * BY THE Xiph.Org FOUNDATION http://www.xiph.org/ * 11 | * * 12 | ******************************************************************** 13 | 14 | function: #ifdef jail to whip a few platforms into the UNIX ideal. 15 | 16 | ********************************************************************/ 17 | #ifndef _OS_CVTYPES_H 18 | #define _OS_CVTYPES_H 19 | 20 | typedef long long ogg_int64_t; 21 | typedef int ogg_int32_t; 22 | typedef unsigned int ogg_uint32_t; 23 | typedef short ogg_int16_t; 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /components/tremor/debian/Makefile.am: -------------------------------------------------------------------------------- 1 | ## Process this file with automake to produce Makefile.in 2 | 3 | AUTOMAKE_OPTIONS = foreign 4 | 5 | EXTRA_DIST = changelog control copyright libvorbisidec1.install\ 6 | libvorbisidec-dev.install rules 7 | -------------------------------------------------------------------------------- /components/tremor/debian/changelog: -------------------------------------------------------------------------------- 1 | libvorbisidec (1.2.0-1) unstable; urgency=low 2 | 3 | * Initial Release. 4 | 5 | -- Christopher L Cheney Wed, 09 Oct 2002 22:00:00 -0500 6 | 7 | Local variables: 8 | mode: debian-changelog 9 | End: 10 | -------------------------------------------------------------------------------- /components/tremor/debian/control: -------------------------------------------------------------------------------- 1 | Source: libvorbisidec 2 | Section: libs 3 | Priority: optional 4 | Maintainer: Christopher L Cheney 5 | Build-Depends: autotools-dev, debhelper (>> 4.0.18), devscripts, gawk 6 | Standards-Version: 3.5.7.0 7 | 8 | Package: libvorbisidec1 9 | Architecture: any 10 | Section: libs 11 | Depends: ${shlibs:Depends} 12 | Description: Ogg Bitstream Library 13 | Libogg is a library for manipulating ogg bitstreams. It handles 14 | both making ogg bitstreams and getting packets from ogg bitstreams. 15 | 16 | Package: libvorbisidec-dev 17 | Architecture: any 18 | Section: devel 19 | Depends: libvorbisidec1 (= ${Source-Version}), libc6-dev 20 | Description: Ogg Bitstream Library Development 21 | The libogg-dev package contains the header files and documentation 22 | needed to develop applications with libogg. 23 | -------------------------------------------------------------------------------- /components/tremor/debian/copyright: -------------------------------------------------------------------------------- 1 | This package was debianized by Christopher L Cheney on 2 | Wed, 09 Oct 2002 22:00:00 -0500. 3 | 4 | It was downloaded from cvs. 5 | 6 | Upstream Author(s): Monty 7 | 8 | Copyright: 9 | Copyright (c) 2002, Xiph.org Foundation 10 | 11 | Redistribution and use in source and binary forms, with or without 12 | modification, are permitted provided that the following conditions 13 | are met: 14 | 15 | - Redistributions of source code must retain the above copyright 16 | notice, this list of conditions and the following disclaimer. 17 | 18 | - Redistributions in binary form must reproduce the above copyright 19 | notice, this list of conditions and the following disclaimer in the 20 | documentation and/or other materials provided with the distribution. 21 | 22 | - Neither the name of the Xiph.Org Foundation nor the names of its 23 | contributors may be used to endorse or promote products derived from 24 | this software without specific prior written permission. 25 | 26 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 27 | ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 28 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 29 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR 30 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 31 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 32 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 33 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 34 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 35 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 36 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 37 | 38 | -------------------------------------------------------------------------------- /components/tremor/debian/libvorbisidec-dev.install: -------------------------------------------------------------------------------- 1 | debian/tmp/usr/include/tremor/config_types.h 2 | debian/tmp/usr/include/tremor/ivorbiscodec.h 3 | debian/tmp/usr/include/tremor/ivorbisfile.h 4 | debian/tmp/usr/include/tremor/ogg.h 5 | debian/tmp/usr/include/tremor/os_types.h 6 | debian/tmp/usr/lib/libvorbisidec.a 7 | debian/tmp/usr/lib/libvorbisidec.la 8 | debian/tmp/usr/lib/libvorbisidec.so 9 | -------------------------------------------------------------------------------- /components/tremor/debian/libvorbisidec1.install: -------------------------------------------------------------------------------- 1 | debian/tmp/usr/lib/libvorbisidec.so.* 2 | -------------------------------------------------------------------------------- /components/tremor/doc/diff.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Tremor - Vorbisfile Differences 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |

Tremor documentation

Tremor version 1.0 - 20020403

15 | 16 |

Tremor / Vorbisfile API Differences

17 | 18 |

19 | 20 | The Tremor libvorbisidec library exposes an API intended to be as 21 | similar as possible to the familiar 'vorbisfile' library included with 22 | the open source Vorbis reference libraries distributed for free by 23 | Xiph.org. Differences are summarized below.

24 | 25 |

OggVorbis_File structure

26 | 27 | The bittrack and samptrack fields in the OggVorbis_File structure are changed to 29 | 64 bit integers in Tremor, from doubles in vorbisfile. 30 | 31 |

Time-related seek and tell function calls

32 | 33 | The ov_time_total() and ov_time_tell() functions return milliseconds as 35 | 64 bit integers in Tremor. In vorbisfile, these functions returned 36 | seconds as doubles.

37 | 38 | In Tremor, the ov_time_seek() and ov_time_seek_page() calls take 40 | seeking positions in milliseconds as 64 bit integers, rather than in 41 | seconds as doubles as in Vorbisfile.

42 | 43 |

Reading decoded data

44 | 45 | Tremor ov_read() always returns data as 46 | signed 16 bit interleaved PCM in host byte order. As such, it does not 47 | take arguments to request specific signedness, byte order or bit depth 48 | as in Vorbisfile.

49 | 50 | Tremor does not implement ov_read_float().

51 | 52 | 53 |

54 |


55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 |

copyright © 2002 Xiph.org

Ogg Vorbis

Tremor documentation

Tremor version 1.0 - 20020403

64 | 65 | 66 | 67 | 68 | -------------------------------------------------------------------------------- /components/tremor/doc/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Tremor - Documentation 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |

Tremor documentation

Tremor version 1.0 - 20020403

15 | 16 |

Tremor Documentation

17 | 18 |

19 | 20 | The Tremor Vorbis I stream and file decoder provides an embeddable, 21 | integer-only library [libvorbisidec] intended for decoding all current 22 | and future Vorbis I compliant streams. The Tremor libvorbisidec 23 | library exposes an API intended to be as similar as possible to the 24 | familiar 'vorbisfile' library included with the open source Vorbis 25 | reference libraries distributed for free by Xiph.org.

26 | 27 | Tremor can be used along with any ANSI compliant stdio implementation 28 | for file/stream access, or use custom stream i/o routines provided by 29 | the embedded environment. Both uses are described in detail in this 30 | documentation. 31 | 32 |

33 | Building libvorbisidec
34 | API overview
35 | API reference
36 | Example code
37 | Tremor / vorbisfile API differences
38 | 39 |

40 |


41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 |

copyright © 2002 Xiph.org

Ogg Vorbis

Tremor documentation

Tremor version 1.0 - 20020403

50 | 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /components/tremor/doc/ov_bitrate_instant.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Tremor - function - ov_bitrate 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |

Tremor documentation

Tremor version 1.0 - 20020403

15 | 16 |

ov_bitrate_instant

17 | 18 |

declared in "ivorbisfile.h";

19 | 20 |

Used to find the most recent bitrate played back within the file. Will return 0 if the bitrate has not changed or it is the beginning of the file. 21 | 22 |

23 | 24 | 25 | 30 | 31 |
26 |

27 | long ov_bitrate_instant(OggVorbis_File *vf);
28 | 
29 |
32 | 33 |

Parameters

34 |
35 |
vf
36 |
A pointer to the OggVorbis_File structure--this is used for ALL the externally visible libvorbisidec 37 | functions. 38 |
39 | 40 | 41 |

Return Values

42 |
43 |
  • 0 indicates the beginning of the file or unchanged bitrate info.
  • 44 |
  • n indicates the actual bitrate since the last call.
  • 45 |
  • OV_FALSE indicates that playback is not in progress, and thus there is no instantaneous bitrate information to report.
  • 46 |
  • OV_EINVAL indicates that the stream represented by vf is not open.
  • 47 |
    48 |

    49 | 50 | 51 |

    52 |


    53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 |

    copyright © 2002 Xiph.org

    Ogg Vorbis

    Tremor documentation

    Tremor version 1.0 - 20020403

    62 | 63 | 64 | 65 | 66 | -------------------------------------------------------------------------------- /components/tremor/doc/ov_clear.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Tremor - function - ov_clear 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |

    Tremor documentation

    Tremor version 1.0 - 20020403

    15 | 16 |

    ov_clear

    17 | 18 |

    declared in "ivorbisfile.h";

    19 | 20 |

    After a bitstream has been opened using ov_open()/ov_open_callbacks() and decoding is complete, the application must call ov_clear() to clear 21 | the decoder's buffers and close the file.

    22 | 23 | ov_clear() must also be called after a successful call to ov_test() or ov_test_callbacks().

    24 | 25 |

    26 | 27 | 28 | 33 | 34 |
    29 |
    
    30 | int ov_clear(OggVorbis_File *vf);
    31 | 
    32 |
    35 | 36 |

    Parameters

    37 |
    38 |
    vf
    39 |
    A pointer to the OggVorbis_File structure--this is used for ALL the externally visible libvorbisidec 40 | functions. After ov_clear has been called, the structure is deallocated and can no longer be used.
    41 |
    42 | 43 | 44 |

    Return Values

    45 |
    46 |
  • 0 for success
  • 47 |
    48 | 49 | 50 |

    51 |
    52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 |

    copyright © 2002 Xiph.org

    Ogg Vorbis

    Tremor documentation

    Tremor version 1.0 - 20020403

    61 | 62 | 63 | 64 | 65 | -------------------------------------------------------------------------------- /components/tremor/doc/ov_comment.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Tremor - function - ov_bitrate 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |

    Tremor documentation

    Tremor version 1.0 - 20020403

    16 | 17 |

    ov_comment

    18 | 19 |

    declared in "ivorbisfile.h";

    20 | 21 |

    Returns a pointer to the vorbis_comment struct for the specified bitstream. For nonseekable streams, returns the struct for the current bitstream. 22 |

    23 | 24 |

    25 | 26 | 27 | 32 | 33 |
    28 |
    
    29 | vorbis_comment *ov_comment(OggVorbis_File *vf,int link);
    30 | 
    31 |
    34 | 35 |

    Parameters

    36 |
    37 |
    vf
    38 |
    A pointer to the OggVorbis_File structure--this is used for ALL the externally visible libvorbisidec 39 | functions.
    40 |
    i
    41 |
    Link to the desired logical bitstream. For nonseekable files, this argument is ignored. To retrieve the vorbis_comment struct for the current bitstream, this parameter should be set to -1.
    42 |
    43 | 44 | 45 |

    Return Values

    46 |
    47 |
  • Returns the vorbis_comment struct for the specified bitstream.
  • 48 |
  • NULL if the specified bitstream does not exist or the file has been initialized improperly.
  • 49 |
    50 |

    51 | 52 |

    53 |


    54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 |

    copyright © 2002 Xiph.org

    Ogg Vorbis

    Tremor documentation

    Tremor version 1.0 - 20020403

    63 | 64 | 65 | 66 | 67 | -------------------------------------------------------------------------------- /components/tremor/doc/ov_info.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Tremor - function - ov_info 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |

    Tremor documentation

    Tremor version 1.0 - 20020403

    15 | 16 |

    ov_info

    17 | 18 |

    declared in "ivorbisfile.h";

    19 | 20 |

    Returns the vorbis_info struct for the specified bitstream. For nonseekable files, always returns the current vorbis_info struct. 21 | 22 |

    23 | 24 | 25 | 30 | 31 |
    26 |
    
    27 | vorbis_info *ov_info(OggVorbis_File *vf,int link);
    28 | 
    29 |
    32 | 33 |

    Parameters

    34 |
    35 |
    vf
    36 |
    A pointer to the OggVorbis_File structure--this is used for ALL the externally visible libvorbisidec 37 | functions.
    38 |
    i
    39 |
    Link to the desired logical bitstream. For nonseekable files, this argument is ignored. To retrieve the vorbis_info struct for the current bitstream, this parameter should be set to -1.
    40 |
    41 | 42 | 43 |

    Return Values

    44 |
    45 |
  • Returns the vorbis_info struct for the specified bitstream. Returns vorbis_info for current bitstream if the file is nonseekable or i=-1.
  • 46 |
  • NULL if the specified bitstream does not exist or the file has been initialized improperly.
  • 47 |
    48 |

    49 | 50 |

    51 |


    52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 |

    copyright © 2002 Xiph.org

    Ogg Vorbis

    Tremor documentation

    Tremor version 1.0 - 20020403

    61 | 62 | 63 | 64 | 65 | -------------------------------------------------------------------------------- /components/tremor/doc/ov_pcm_seek.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Tremor - function - ov_pcm_seek 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |

    Tremor documentation

    Tremor version 1.0 - 20020403

    15 | 16 |

    ov_pcm_seek

    17 | 18 |

    declared in "ivorbisfile.h";

    19 | 20 |

    Seeks to the offset specified (in pcm samples) within the physical bitstream. This function only works for seekable streams. 21 |

    This also updates everything needed within the 22 | decoder, so you can immediately call ov_read() and get data from 23 | the newly seeked to position. 24 |

    25 | 26 |

    27 | 28 | 29 | 34 | 35 |
    30 |
    
    31 | int ov_pcm_seek(OggVorbis_File *vf,ogg_int64_t pos);
    32 | 
    33 |
    36 | 37 |

    Parameters

    38 |
    39 |
    vf
    40 |
    A pointer to the OggVorbis_File structure--this is used for ALL the externally visible libvorbisidec 41 | functions.
    42 |
    pos
    43 |
    Position in pcm samples to seek to in the bitstream.
    44 |
    45 | 46 | 47 |

    Return Values

    48 |
    49 |
  • 0 for success
  • 50 | 51 |
  • 52 | nonzero indicates failure, described by several error codes:
  • 53 |
      54 |
    • OV_ENOSEEK - Bitstream is not seekable. 55 |
    • 56 |
    • OV_EINVAL - Invalid argument value. 57 |
    • 58 |
    • OV_EREAD - A read from media returned an error. 59 |
    • 60 |
    • OV_EFAULT - Internal logic fault; indicates a bug or heap/stack 61 | corruption. 62 |
    • 63 |
    • OV_EBADLINK - Invalid stream section supplied to libvorbisidec, or the requested link is corrupt. 64 |
    • 65 |
    66 | 67 |

    68 |
    69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 |

    copyright © 2002 Xiph.org

    Ogg Vorbis

    Tremor documentation

    Tremor version 1.0 - 20020403

    78 | 79 | 80 | 81 | 82 | -------------------------------------------------------------------------------- /components/tremor/doc/ov_pcm_tell.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Tremor - function - ov_pcm_tell 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |

    Tremor documentation

    Tremor version 1.0 - 20020403

    15 | 16 |

    ov_pcm_tell

    17 | 18 |

    declared in "ivorbisfile.h";

    19 | 20 |

    Returns the current offset in samples. 21 | 22 |

    23 | 24 | 25 | 30 | 31 |
    26 |
    
    27 | ogg_int64_t ov_pcm_tell(OggVorbis_File *vf);
    28 | 
    29 |
    32 | 33 |

    Parameters

    34 |
    35 |
    vf
    36 |
    A pointer to the OggVorbis_File structure--this is used for ALL the externally visible libvorbisidec 37 | functions.
    38 |
    39 | 40 | 41 |

    Return Values

    42 |
    43 |
  • n indicates the current offset in samples.
  • 44 |
  • OV_EINVAL means that the argument was invalid. In this case, the requested bitstream did not exist.
  • 45 |
    46 |

    47 | 48 | 49 |

    50 |


    51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 |

    copyright © 2002 Xiph.org

    Ogg Vorbis

    Tremor documentation

    Tremor version 1.0 - 20020403

    60 | 61 | 62 | 63 | 64 | -------------------------------------------------------------------------------- /components/tremor/doc/ov_pcm_total.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Tremor - function - ov_pcm_total 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |

    Tremor documentation

    Tremor version 1.0 - 20020403

    15 | 16 |

    ov_pcm_total

    17 | 18 |

    declared in "ivorbisfile.h";

    19 | 20 |

    Returns the total pcm samples of the physical bitstream or a specified logical bitstream. 21 | 22 |

    23 | 24 | 25 | 30 | 31 |
    26 |
    
    27 | ogg_int64_t ov_pcm_total(OggVorbis_File *vf,int i);
    28 | 
    29 |
    32 | 33 |

    Parameters

    34 |
    35 |
    vf
    36 |
    A pointer to the OggVorbis_File structure--this is used for ALL the externally visible libvorbisidec 37 | functions.
    38 |
    i
    39 |
    Link to the desired logical bitstream. To retrieve the total pcm samples for the entire physical bitstream, this parameter should be set to -1.
    40 |
    41 | 42 | 43 |

    Return Values

    44 |
    45 |
  • OV_EINVAL means that the argument was invalid. In this case, the requested bitstream did not exist or the bitstream is unseekable.
  • 46 |
  • 47 | total length in pcm samples of content if i=-1.
  • 48 |
  • length in pcm samples of logical bitstream if i=1 to n.
  • 49 |
    50 |

    51 | 52 | 53 |

    54 |


    55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 |

    copyright © 2002 Xiph.org

    Ogg Vorbis

    Tremor documentation

    Tremor version 1.0 - 20020403

    64 | 65 | 66 | 67 | 68 | -------------------------------------------------------------------------------- /components/tremor/doc/ov_raw_seek.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Tremor - function - ov_raw_seek 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |

    Tremor documentation

    Tremor version 1.0 - 20020403

    15 | 16 |

    ov_raw_seek

    17 | 18 |

    declared in "ivorbisfile.h";

    19 | 20 |

    Seeks to the offset specified (in compressed raw bytes) within the physical bitstream. This function only works for seekable streams. 21 |

    This also updates everything needed within the 22 | decoder, so you can immediately call ov_read() and get data from 23 | the newly seeked to position. 24 |

    When seek speed is a priority, this is the best seek funtion to use. 25 |

    26 | 27 | 28 | 33 | 34 |
    29 |
    
    30 | int ov_raw_seek(OggVorbis_File *vf,long pos);
    31 | 
    32 |
    35 | 36 |

    Parameters

    37 |
    38 |
    vf
    39 |
    A pointer to the OggVorbis_File structure--this is used for ALL the externally visible libvorbisidec 40 | functions.
    41 |
    pos
    42 |
    Position in compressed bytes to seek to in the bitstream.
    43 |
    44 | 45 | 46 |

    Return Values

    47 |
    48 |
  • 0 indicates success
  • 49 |
  • nonzero indicates failure, described by several error codes:
  • 50 |
      51 |
    • OV_ENOSEEK - Bitstream is not seekable. 52 |
    • 53 |
    • OV_EINVAL - Invalid argument value. 54 |
    • 55 |
    • OV_EBADLINK - Invalid stream section supplied to libvorbisidec, or the requested link is corrupt. 56 |
    • 57 |
    58 |
    59 |

    60 | 61 |

    62 |


    63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 |

    copyright © 2002 Xiph.org

    Ogg Vorbis

    Tremor documentation

    Tremor version 1.0 - 20020403

    72 | 73 | 74 | 75 | 76 | -------------------------------------------------------------------------------- /components/tremor/doc/ov_raw_tell.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Tremor - function - ov_raw_tell 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |

    Tremor documentation

    Tremor version 1.0 - 20020403

    15 | 16 |

    ov_raw_tell

    17 | 18 |

    declared in "ivorbisfile.h";

    19 | 20 |

    Returns the current offset in raw compressed bytes. 21 | 22 |

    23 | 24 | 25 | 30 | 31 |
    26 |
    
    27 | ogg_int64_t ov_raw_tell(OggVorbis_File *vf);
    28 | 
    29 |
    32 | 33 |

    Parameters

    34 |
    35 |
    vf
    36 |
    A pointer to the OggVorbis_File structure--this is used for ALL the externally visible libvorbisidec 37 | functions.
    38 |
    39 | 40 | 41 |

    Return Values

    42 |
    43 |
  • n indicates the current offset in bytes.
  • 44 |
  • OV_EINVAL means that the argument was invalid. In this case, the requested bitstream did not exist.
  • 45 |
    46 |

    47 | 48 | 49 |

    50 |


    51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 |

    copyright © 2002 Xiph.org

    Ogg Vorbis

    Tremor documentation

    Tremor version 1.0 - 20020403

    60 | 61 | 62 | 63 | 64 | -------------------------------------------------------------------------------- /components/tremor/doc/ov_raw_total.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Tremor - function - ov_raw_total 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |

    Tremor documentation

    Tremor version 1.0 - 20020403

    15 | 16 |

    ov_raw_total

    17 | 18 |

    declared in "ivorbisfile.h";

    19 | 20 |

    Returns the total (compressed) bytes of the physical bitstream or a specified logical bitstream. 21 | 22 |

    23 | 24 | 25 | 30 | 31 |
    26 |
    
    27 | ogg_int64_t ov_raw_total(OggVorbis_File *vf,int i);
    28 | 
    29 |
    32 | 33 |

    Parameters

    34 |
    35 |
    vf
    36 |
    A pointer to the OggVorbis_File structure--this is used for ALL the externally visible libvorbisidec 37 | functions.
    38 |
    i
    39 |
    Link to the desired logical bitstream. To retrieve the total bytes for the entire physical bitstream, this parameter should be set to -1.
    40 |
    41 | 42 | 43 |

    Return Values

    44 |
    45 |
  • OV_EINVAL means that the argument was invalid. In this case, the requested bitstream did not exist or the bitstream is nonseekable
  • 46 |
  • n 47 | total length in compressed bytes of content if i=-1.
  • 48 |
  • n length in compressed bytes of logical bitstream if i=1 to n.
  • 49 |
    50 |

    51 | 52 | 53 | 54 |

    55 |


    56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 |

    copyright © 2002 Xiph.org

    Ogg Vorbis

    Tremor documentation

    Tremor version 1.0 - 20020403

    65 | 66 | 67 | 68 | 69 | -------------------------------------------------------------------------------- /components/tremor/doc/ov_seekable.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Tremor - function - ov_seekable 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |

    Tremor documentation

    Tremor version 1.0 - 20020403

    15 | 16 |

    ov_seekable

    17 | 18 |

    declared in "ivorbisfile.h";

    19 | 20 |

    This indicates whether or not the bitstream is seekable. 21 | 22 | 23 |

    24 | 25 | 26 | 31 | 32 |
    27 |
    
    28 | long ov_seekable(OggVorbis_File *vf);
    29 | 
    30 |
    33 | 34 |

    Parameters

    35 |
    36 |
    vf
    37 |
    A pointer to the OggVorbis_File structure--this is used for ALL the externally visible libvorbisidec 38 | functions.
    39 |
    40 | 41 | 42 |

    Return Values

    43 |
    44 |
  • 0 indicates that the file is not seekable.
  • 45 |
  • nonzero indicates that the file is seekable.
  • 46 |
    47 |

    48 | 49 |

    50 |


    51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 |

    copyright © 2002 Xiph.org

    Ogg Vorbis

    Tremor documentation

    Tremor version 1.0 - 20020403

    60 | 61 | 62 | 63 | 64 | -------------------------------------------------------------------------------- /components/tremor/doc/ov_serialnumber.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Tremor - function - ov_serialnumber 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |

    Tremor documentation

    Tremor version 1.0 - 20020403

    15 | 16 |

    ov_serialnumber

    17 | 18 |

    declared in "ivorbisfile.h";

    19 | 20 |

    Returns the serialnumber of the specified logical bitstream link number within the overall physical bitstream. 21 | 22 |

    23 | 24 | 25 | 30 | 31 |
    26 |
    
    27 | long ov_serialnumber(OggVorbis_File *vf,int i);
    28 | 
    29 |
    32 | 33 |

    Parameters

    34 |
    35 |
    vf
    36 |
    A pointer to the OggVorbis_File structure--this is used for ALL the externally visible libvorbisidec 37 | functions.
    38 |
    i
    39 |
    Link to the desired logical bitstream. For nonseekable files, this argument is ignored. To retrieve the serial number of the current bitstream, this parameter should be set to -1.
    40 |
    41 | 42 | 43 |

    Return Values

    44 |
    45 |
  • 46 | -1 if the specified logical bitstream i does not exist.
  • 47 | 48 |
  • Returns the serial number of the logical bitstream i or the serial number of the current bitstream if the file is nonseekable.
  • 49 |
    50 |

    51 | 52 | 53 |

    54 |


    55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 |

    copyright © 2002 Xiph.org

    Ogg Vorbis

    Tremor documentation

    Tremor version 1.0 - 20020403

    64 | 65 | 66 | 67 | 68 | -------------------------------------------------------------------------------- /components/tremor/doc/ov_streams.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Tremor - function - ov_streams 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |

    Tremor documentation

    Tremor version 1.0 - 20020403

    15 | 16 |

    ov_streams

    17 | 18 |

    declared in "ivorbisfile.h";

    19 | 20 |

    Returns the number of logical bitstreams within our physical bitstream. 21 | 22 |

    23 | 24 | 25 | 30 | 31 |
    26 |
    
    27 | long ov_streams(OggVorbis_File *vf);
    28 | 
    29 |
    32 | 33 |

    Parameters

    34 |
    35 |
    vf
    36 |
    A pointer to the OggVorbis_File structure--this is used for ALL the externally visible libvorbisidec 37 | functions.
    38 |
    39 | 40 | 41 |

    Return Values

    42 |
    43 |
  • 44 | 1 indicates a single logical bitstream or an unseekable file.
  • 45 |
  • n indicates the number of logical bitstreams.
  • 46 |
    47 |

    48 | 49 | 50 |

    51 |


    52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 |

    copyright © 2002 Xiph.org

    Ogg Vorbis

    Tremor documentation

    Tremor version 1.0 - 20020403

    61 | 62 | 63 | 64 | 65 | -------------------------------------------------------------------------------- /components/tremor/doc/ov_test_open.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Tremor - function - ov_test_open 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |

    Tremor documentation

    Tremor version 1.0 - 20020403

    15 | 16 |

    ov_test_open

    17 | 18 |

    declared in "ivorbisfile.h";

    19 | 20 |

    21 | Finish opening a file partially opened with ov_test() 22 | or ov_test_callbacks(). 23 |

    24 | 25 | 26 | 27 | 32 | 33 |
    28 |
    
    29 | int ov_test_open(OggVorbis_File *vf);
    30 | 
    31 |
    34 | 35 |

    Parameters

    36 |
    37 |
    vf
    38 |
    A pointer to the OggVorbis_File structure--this is used for ALL the externally visible libvorbisidec 39 | functions. Once this has been called, the same OggVorbis_File 40 | struct should be passed to all the libvorbisidec functions.
    41 |
    42 | 43 | 44 |

    Return Values

    45 |
    46 |
  • 47 | 0 for success
  • 48 | 49 |
  • less than zero for failure:
  • 50 |
      51 |
    • OV_EREAD - A read from media returned an error.
    • 52 |
    • OV_ENOTVORBIS - Bitstream is not Vorbis data.
    • 53 |
    • OV_EVERSION - Vorbis version mismatch.
    • 54 |
    • OV_EBADHEADER - Invalid Vorbis bitstream header.
    • 55 |
    • OV_EFAULT - Internal logic fault; indicates a bug or heap/stack corruption.
    • 56 |
    57 |
    58 |

    59 | 60 | 61 |

    62 |


    63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 |

    copyright © 2002 Xiph.org

    Ogg Vorbis

    Tremor documentation

    Tremor version 1.0 - 20020403

    72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | -------------------------------------------------------------------------------- /components/tremor/doc/ov_time_seek.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Tremor - function - ov_time_seek 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |

    Tremor documentation

    Tremor version 1.0 - 20020403

    15 | 16 |

    ov_time_seek

    17 | 18 |

    declared in "ivorbisfile.h";

    19 | 20 |

    For seekable 21 | streams, this seeks to the given time. For implementing seeking in a player, 22 | this is the only function generally needed. This also updates everything needed within the 23 | decoder, so you can immediately call ov_read() and get data from 24 | the newly seeked to position. This function does not work for unseekable streams. 25 | 26 |

    27 | 28 | 29 | 34 | 35 |
    30 |
    
    31 | int ov_time_seek(OggVorbis_File *vf, ogg_int64_t ms);
    32 | 
    33 |
    36 | 37 |

    Parameters

    38 |
    39 |
    vf
    40 |
    Pointer to our already opened and initialized OggVorbis_File structure.
    41 |
    ms
    42 |
    Location to seek to within the file, specified in milliseconds.
    43 |
    44 | 45 | 46 |

    Return Values

    47 |
    48 |
  • 49 | 0 for success
  • 50 | 51 |
  • 52 | Nonzero for failure
  • 53 |
    54 | 55 | 56 |

    57 |
    58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 |

    copyright © 2002 Xiph.org

    Ogg Vorbis

    Tremor documentation

    Tremor version 1.0 - 20020403

    67 | 68 | 69 | 70 | 71 | -------------------------------------------------------------------------------- /components/tremor/doc/ov_time_tell.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Tremor - function - ov_bitrate 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |

    Tremor documentation

    Tremor version 1.0 - 20020403

    15 | 16 |

    ov_time_tell

    17 | 18 |

    declared in "ivorbisfile.h";

    19 | 20 |

    Returns the current decoding offset in milliseconds. 21 | 22 |

    23 | 24 | 25 | 30 | 31 |
    26 |
    
    27 | ogg_int64_t ov_time_tell(OggVorbis_File *vf);
    28 | 
    29 |
    32 | 33 |

    Parameters

    34 |
    35 |
    vf
    36 |
    A pointer to the OggVorbis_File structure--this is used for ALL the externally visible libvorbisidec 37 | functions.
    38 |
    39 | 40 | 41 |

    Return Values

    42 |
    43 |
  • n indicates the current decoding time offset in milliseconds.
  • 44 |
  • OV_EINVAL means that the argument was invalid. In this case, the requested bitstream did not exist.
  • 45 |
    46 |

    47 | 48 | 49 |

    50 |


    51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 |

    copyright © 2002 Xiph.org

    Ogg Vorbis

    Tremor documentation

    Tremor version 1.0 - 20020403

    60 | 61 | 62 | 63 | 64 | -------------------------------------------------------------------------------- /components/tremor/doc/ov_time_total.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Tremor - function - ov_time_total 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |

    Tremor documentation

    Tremor version 1.0 - 20020403

    15 | 16 |

    ov_time_total

    17 | 18 |

    declared in "ivorbisfile.h";

    19 | 20 | 21 |

    Returns the total time in seconds of the physical bitstream or a specified logical bitstream. 22 | 23 | 24 |

    25 | 26 | 27 | 32 | 33 |
    28 |
    
    29 | ogg_int64_t ov_time_total(OggVorbis_File *vf,int i);
    30 | 
    31 |
    34 | 35 |

    Parameters

    36 |
    37 |
    vf
    38 |
    A pointer to the OggVorbis_File structure--this is used for ALL the externally visible libvorbisidec 39 | functions.
    40 |
    i
    41 |
    Link to the desired logical bitstream. To retrieve the time total for the entire physical bitstream, this parameter should be set to -1.
    42 |
    43 | 44 | 45 |

    Return Values

    46 |
    47 |
  • OV_EINVAL means that the argument was invalid. In this case, the requested bitstream did not exist or the bitstream is nonseekable.
  • 48 |
  • n total length in milliseconds of content if i=-1.
  • 49 |
  • n length in milliseconds of logical bitstream if i=1 to n.
  • 50 |
    51 |

    52 | 53 |

    54 |


    55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 |

    copyright © 2002 Xiph.org

    Ogg Vorbis

    Tremor documentation

    Tremor version 1.0 - 20020403

    64 | 65 | 66 | 67 | 68 | -------------------------------------------------------------------------------- /components/tremor/doc/overview.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Tremor - API Overview 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |

    Tremor documentation

    Tremor version 1.0 - 20020403

    15 | 16 |

    Tremor API Overview

    17 | 18 |

    The makeup of the Tremor libvorbisidec library API is relatively 19 | simple. It revolves around a single file resource. This file resource is 20 | passed to libvorbisidec, where it is opened, manipulated, and closed, 21 | in the form of an OggVorbis_File 22 | struct. 23 |

    24 | The Tremor API consists of the following functional categories: 25 |

    26 |

    33 |

    34 | In addition, the following subjects deserve attention additional to 35 | the above general overview: 36 |

    37 |

    43 |

    44 | 45 | 46 |

    47 |


    48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 |

    copyright © 2002 Xiph.org

    Ogg Vorbis

    Tremor documentation

    Tremor version 1.0 - 20020403

    57 | 58 | 59 | 60 | 61 | 62 | -------------------------------------------------------------------------------- /components/tremor/doc/return.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Tremor - Return Codes 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |

    Tremor documentation

    Tremor version 1.0 - 20020403

    15 | 16 |

    Return Codes

    17 | 18 |

    19 | 20 | The following return codes are #defined in "ivorbiscodec.h" 21 | may be returned by libvorbisidec. Descriptions of a code relevant to 22 | a specific function are found in the reference description of that 23 | function. 24 | 25 |

    26 | 27 |
    OV_FALSE
    28 |
    Not true, or no data available
    29 | 30 |
    OV_HOLE
    31 |
    Tremor encoutered missing or corrupt data in the bitstream. Recovery 32 | is normally automatic and this return code is for informational purposes only.
    33 | 34 |
    OV_EREAD
    35 |
    Read error while fetching compressed data for decode
    36 | 37 |
    OV_EFAULT
    38 |
    Internal inconsistency in decode state. Continuing is likely not possible.
    39 | 40 |
    OV_EIMPL
    41 |
    Feature not implemented
    42 | 43 |
    OV_EINVAL
    44 |
    Either an invalid argument, or incompletely initialized argument passed to libvorbisidec call
    45 | 46 |
    OV_ENOTVORBIS
    47 |
    The given file/data was not recognized as Ogg Vorbis data.
    48 | 49 |
    OV_EBADHEADER
    50 |
    The file/data is apparently an Ogg Vorbis stream, but contains a corrupted or undecipherable header.
    51 | 52 |
    OV_EVERSION
    53 |
    The bitstream format revision of the given stream is not supported.
    54 | 55 |
    OV_EBADLINK
    56 |
    The given link exists in the Vorbis data stream, but is not decipherable due to garbacge or corruption.
    57 | 58 |
    OV_ENOSEEK
    59 |
    The given stream is not seekable
    60 | 61 |
    62 | 63 |

    64 |
    65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 |

    copyright © 2002 Xiph.org

    Ogg Vorbis

    Tremor documentation

    Tremor version 1.0 - 20020403

    74 | 75 | 76 | 77 | 78 | -------------------------------------------------------------------------------- /components/tremor/doc/style.css: -------------------------------------------------------------------------------- 1 | BODY { font-family: Helvetica, sans-serif } 2 | TD { font-family: Helvetica, sans-serif } 3 | P { font-family: Helvetica, sans-serif } 4 | H1 { font-family: Helvetica, sans-serif } 5 | H2 { font-family: Helvetica, sans-serif } 6 | H4 { font-family: Helvetica, sans-serif } 7 | P.tiny { font-size: 8pt } 8 | -------------------------------------------------------------------------------- /components/tremor/doc/threads.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Tremor - Thread Safety 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |

    Tremor documentation

    Tremor version 1.0 - 20020403

    15 | 16 |

    Thread Safety

    17 | 18 | Tremor's libvorbisidec may be used safely in a threading environment 19 | so long as thread access to individual OggVorbis_File instances is serialized. 21 |
      22 | 23 |
    • Only one thread at a time may enter a function that takes a given OggVorbis_File instance, even if the 25 | functions involved appear to be read-only.

      26 | 27 |

    • Multiple threads may enter 28 | libvorbisidec at a given time, so long as each thread's function calls 29 | are using different OggVorbis_File 30 | instances.

      31 | 32 |

    • Any one OggVorbis_File instance may be used safely from multiple threads so long as only one thread at a time is making calls using that instance.

      34 |

    35 | 36 |

    37 |
    38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 |

    copyright © 2002 Xiph.org

    Ogg Vorbis

    Tremor documentation

    Tremor version 1.0 - 20020403

    47 | 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /components/tremor/doc/vorbis_comment.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Tremor - datatype - vorbis_comment 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |

    Tremor documentation

    Tremor version 1.0 - 20020403

    15 | 16 |

    vorbis_comment

    17 | 18 |

    declared in "ivorbiscodec.h"

    19 | 20 |

    21 | The vorbis_comment structure defines an Ogg Vorbis comment. 22 |

    23 | Only the fields the program needs must be defined. If a field isn't 24 | defined by the application, it will either be blank (if it's a string value) 25 | or set to some reasonable default (usually 0). 26 |

    27 | 28 | 29 | 30 | 40 | 41 |
    31 |
    typedef struct vorbis_comment{
    32 |   /* unlimited user comment fields. */
    33 |   char **user_comments;
    34 |   int  *comment_lengths;
    35 |   int  comments;
    36 |   char *vendor;
    37 | 
    38 | } vorbis_comment;
    39 |
    42 | 43 |

    Parameters

    44 |
    45 |
    user_comments
    46 |
    Unlimited user comment array. The individual strings in the array are 8 bit clean, by the Vorbis specification, and as such the comment_lengths array should be consulted to determine string length. For convenience, each string is also NULL-terminated by the decode library (although Vorbis comments are not NULL terminated within the bitstream itself).
    47 |
    comment_lengths
    48 |
    An int array that stores the length of each comment string
    49 |
    comments
    50 |
    Int signifying number of user comments in user_comments field.
    51 |
    vendor
    52 |
    Information about the creator of the file. Stored in a standard C 0-terminated string.
    53 |
    54 | 55 | 56 |

    57 |
    58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 |

    copyright © 2002 Xiph.org

    Ogg Vorbis

    Tremor documentation

    Tremor version 1.0 - 20020403

    67 | 68 | 69 | 70 | 71 | -------------------------------------------------------------------------------- /components/tremor/mdct.h: -------------------------------------------------------------------------------- 1 | /******************************************************************** 2 | * * 3 | * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE. * 4 | * * 5 | * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * 6 | * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * 7 | * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * 8 | * * 9 | * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002 * 10 | * BY THE Xiph.Org FOUNDATION http://www.xiph.org/ * 11 | * * 12 | ******************************************************************** 13 | 14 | function: modified discrete cosine transform prototypes 15 | 16 | ********************************************************************/ 17 | 18 | #ifndef _OGG_mdct_H_ 19 | #define _OGG_mdct_H_ 20 | 21 | #include "ivorbiscodec.h" 22 | #include "misc.h" 23 | 24 | #define DATA_TYPE ogg_int32_t 25 | #define REG_TYPE register ogg_int32_t 26 | 27 | #ifdef _LOW_ACCURACY_ 28 | #define cPI3_8 (0x0062) 29 | #define cPI2_8 (0x00b5) 30 | #define cPI1_8 (0x00ed) 31 | #else 32 | #define cPI3_8 (0x30fbc54d) 33 | #define cPI2_8 (0x5a82799a) 34 | #define cPI1_8 (0x7641af3d) 35 | #endif 36 | 37 | extern void mdct_forward(int n, DATA_TYPE *in, DATA_TYPE *out); 38 | extern void mdct_backward(int n, DATA_TYPE *in, DATA_TYPE *out); 39 | 40 | #endif 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /components/tremor/registry.c: -------------------------------------------------------------------------------- 1 | /******************************************************************** 2 | * * 3 | * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE. * 4 | * * 5 | * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * 6 | * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * 7 | * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * 8 | * * 9 | * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002 * 10 | * BY THE Xiph.Org FOUNDATION http://www.xiph.org/ * 11 | * * 12 | ******************************************************************** 13 | 14 | function: registry for floor, res backends and channel mappings 15 | 16 | ********************************************************************/ 17 | 18 | #include "ivorbiscodec.h" 19 | #include "codec_internal.h" 20 | #include "registry.h" 21 | #include "misc.h" 22 | 23 | 24 | /* seems like major overkill now; the backend numbers will grow into 25 | the infrastructure soon enough */ 26 | 27 | extern vorbis_func_floor floor0_exportbundle; 28 | extern vorbis_func_floor floor1_exportbundle; 29 | extern vorbis_func_residue residue0_exportbundle; 30 | extern vorbis_func_residue residue1_exportbundle; 31 | extern vorbis_func_residue residue2_exportbundle; 32 | extern vorbis_func_mapping mapping0_exportbundle; 33 | 34 | vorbis_func_floor *_floor_P[]={ 35 | &floor0_exportbundle, 36 | &floor1_exportbundle, 37 | }; 38 | 39 | vorbis_func_residue *_residue_P[]={ 40 | &residue0_exportbundle, 41 | &residue1_exportbundle, 42 | &residue2_exportbundle, 43 | }; 44 | 45 | vorbis_func_mapping *_mapping_P[]={ 46 | &mapping0_exportbundle, 47 | }; 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /components/tremor/registry.h: -------------------------------------------------------------------------------- 1 | /******************************************************************** 2 | * * 3 | * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE. * 4 | * * 5 | * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * 6 | * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * 7 | * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * 8 | * * 9 | * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002 * 10 | * BY THE Xiph.Org FOUNDATION http://www.xiph.org/ * 11 | * * 12 | ******************************************************************** 13 | 14 | function: registry for time, floor, res backends and channel mappings 15 | 16 | ********************************************************************/ 17 | 18 | #ifndef _V_REG_H_ 19 | #define _V_REG_H_ 20 | 21 | #define VI_TRANSFORMB 1 22 | #define VI_WINDOWB 1 23 | #define VI_TIMEB 1 24 | #define VI_FLOORB 2 25 | #define VI_RESB 3 26 | #define VI_MAPB 1 27 | 28 | #include "backends.h" 29 | 30 | #if defined(_WIN32) && defined(VORBISDLL_IMPORT) 31 | # define EXTERN __declspec(dllimport) extern 32 | #else 33 | # define EXTERN extern 34 | #endif 35 | 36 | EXTERN vorbis_func_floor *_floor_P[]; 37 | EXTERN vorbis_func_residue *_residue_P[]; 38 | EXTERN vorbis_func_mapping *_mapping_P[]; 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /components/tremor/vorbisidec.pc.in: -------------------------------------------------------------------------------- 1 | # libvorbisidec pkg-config source file 2 | 3 | prefix=@prefix@ 4 | exec_prefix=@exec_prefix@ 5 | libdir=@libdir@ 6 | includedir=@includedir@ 7 | 8 | Name: vorbisidec 9 | Description: vorbisidec is the integer Ogg Vorbis library 10 | Version: @VERSION@ 11 | Requires.private: ogg 12 | Conflicts: 13 | Libs: -L${libdir} -lvorbisidec 14 | Cflags: -I${includedir} 15 | -------------------------------------------------------------------------------- /components/tremor/win32/VS2005/libogg.vsprops: -------------------------------------------------------------------------------- 1 | 2 | 7 | 11 | 15 | 19 | 20 | -------------------------------------------------------------------------------- /components/tremor/win32/VS2008/libogg.vsprops: -------------------------------------------------------------------------------- 1 | 2 | 7 | 11 | 15 | 19 | 20 | -------------------------------------------------------------------------------- /components/tremor/window.h: -------------------------------------------------------------------------------- 1 | /******************************************************************** 2 | * * 3 | * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE. * 4 | * * 5 | * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * 6 | * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * 7 | * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * 8 | * * 9 | * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002 * 10 | * BY THE Xiph.Org FOUNDATION http://www.xiph.org/ * 11 | * * 12 | ******************************************************************** 13 | 14 | function: window functions 15 | 16 | ********************************************************************/ 17 | 18 | #ifndef _V_WINDOW_ 19 | #define _V_WINDOW_ 20 | 21 | extern const void *_vorbis_window(int type,int left); 22 | extern void _vorbis_apply_window(ogg_int32_t *d,const void *window[2], 23 | long *blocksizes, 24 | int lW,int W,int nW); 25 | 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /dlna/connmgr.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 1 5 | 0 6 | 7 | 8 | 9 | GetProtocolInfo 10 | 11 | 12 | Source 13 | out 14 | SourceProtocolInfo 15 | 16 | 17 | Sink 18 | out 19 | SinkProtocolInfo 20 | 21 | 22 | 23 | 24 | 25 | 26 | SourceProtocolInfo 27 | string 28 | 29 | 30 | SinkProtocolInfo 31 | string 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /esp-host.sh: -------------------------------------------------------------------------------- 1 | if [ -z "$ESP_HOST" ]; then 2 | export ESP_HOST="netplayer.local" 3 | echo "ESP device host is $ESP_HOST" 4 | else 5 | echo "ESP device host is $ESP_HOST (from env variable)" 6 | fi 7 | 8 | if [ -z "$ESPLINK_HOST" ]; then 9 | export ESPLINK_HOST="192.168.1.78" 10 | fi 11 | -------------------------------------------------------------------------------- /esplink-flash.sh: -------------------------------------------------------------------------------- 1 | set -e 2 | PARTS="$@" 3 | if [ -z "$PARTS" ]; then 4 | PARTS="app" 5 | elif [ -z "$PARTS" ] || [ "$PARTS" == "-h" ] || [ "$PARTS" == "--help" ]; then 6 | echo -e "Script for flashing via an esp-link device and esptool.py\nUsage:" 7 | echo -e "$0 [app|bootldr|otadata|ptable|recovery]" 8 | exit 1 9 | fi 10 | 11 | base="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" 12 | partoffs="$base/partoffset.py $base/partitions.csv \$part" 13 | ADDR_FILES= 14 | for part in $PARTS 15 | do 16 | if [ "$part" == "app" ]; then 17 | ADDR_FILES+="$(eval $partoffs) $base/build/netplayer.bin " 18 | elif [ "$part" == "bootldr" ]; then 19 | ADDR_FILES+="0x1000 $base/build/bootloader/bootloader.bin " 20 | elif [ "$part" == "otadata" ]; then 21 | ADDR_FILES+="$(eval $partoffs) $base/build/ota_data_initial.bin " 22 | elif [ "$part" == "ptable" ]; then 23 | ptfile="$base/build/partition_table/partition-table.bin" 24 | if [ ! -f "$ptfile" ]; then 25 | echo "Partition table bin file not found for IDF version >= 5, trying legacy file" 26 | ptfile="$base/build/partitions.bin" 27 | fi 28 | ADDR_FILES+="0x8000 $ptfile " 29 | elif [ "$part" == "recovery" ]; then 30 | ADDR_FILES+="$(eval $partoffs) $base/recovery/build/recovery.bin " 31 | else 32 | echo "Unrecognized item '$part'" 33 | exit 1; 34 | fi 35 | done 36 | 37 | set -x 38 | esptool.py --chip esp32 --port socket://192.168.1.78:23 --baud 115200 --before default_reset \ 39 | --after hard_reset write_flash -z --flash_mode dio --flash_freq 80m --flash_size detect \ 40 | $ADDR_FILES 41 | -------------------------------------------------------------------------------- /log.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | source ./esp-ip.sh 3 | curl ${ESP_IP}:80/log 4 | -------------------------------------------------------------------------------- /main/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | idf_component_register( 2 | SRC_DIRS . 3 | INCLUDE_DIRS . 4 | REQUIRES st7735 mySystem httpLib libmad libFLAC libhelix-aac tremor 5 | tinyxml myeq equalizer spiffs cspot app_update 6 | ) 7 | 8 | #COMPONENT_EXTRA_INCLUDES := $(BUILD_DIR_BASE)/cspot 9 | -------------------------------------------------------------------------------- /main/autoString.hpp: -------------------------------------------------------------------------------- 1 | #ifndef AUTO_STRING_HPP 2 | #define AUTO_STRING_HPP 3 | 4 | class AutoCString 5 | { 6 | protected: 7 | const char* mStr; 8 | public: 9 | const char* c_str() const { return mStr; } 10 | AutoCString(const char* str): mStr(str){} 11 | ~AutoCString() { clear(); } 12 | void clear() { if (mStr) free((void*)mStr); } 13 | operator bool() const { return mStr != nullptr; } 14 | }; 15 | #endif 16 | -------------------------------------------------------------------------------- /main/board.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alxvasilev/net-player-esp32/e1367196c69028665ef950d16815a7b6aae4aeff/main/board.h -------------------------------------------------------------------------------- /main/btRemote.hpp: -------------------------------------------------------------------------------- 1 | #ifndef __BT_REMOTE_HPP 2 | #define __BT_REMOTE_HPP 3 | 4 | #include "esp_hidh.h" 5 | #include "esp_hid_common.h" 6 | #include 7 | 8 | class BtRemote 9 | { 10 | protected: 11 | esp_hidh_dev_t* mHidDevice = nullptr; 12 | int8_t battLevel = 0; 13 | std::vector> btnReports; 14 | static void sHidhCallback(void * handler_args, esp_event_base_t base, int32_t id, void * event_data); 15 | public: 16 | BtRemote() {} 17 | bool init(); 18 | bool openBtHidDevice(const uint8_t* addr, int bleAddrType=-1); 19 | }; 20 | #endif 21 | -------------------------------------------------------------------------------- /main/component.mk: -------------------------------------------------------------------------------- 1 | CXXFLAGS += -std=gnu++17 2 | # CPPFLAGS += -Dmalloc=my_malloc -Drealloc=my_realloc 3 | COMPONENT_EXTRA_INCLUDES := $(BUILD_DIR_BASE)/cspot 4 | -------------------------------------------------------------------------------- /main/decoderAac.hpp: -------------------------------------------------------------------------------- 1 | #ifndef DECODER_AAC_HPP 2 | #define DECODER_AAC_HPP 3 | 4 | #include "decoderNode.hpp" 5 | 6 | typedef void *HAACDecoder; 7 | class DecoderAac: public Decoder 8 | { 9 | protected: 10 | enum { kInputBufSize = 4096, kMinAllowedAacInputSize = 1024, kOutputMaxSize = 2 * 4 * 11 | 2048 // 1024 if no SBR support, i.e. HELIX_FEATURE_AUDIO_CODEC_AAC_SBR not defined 12 | }; 13 | HAACDecoder mDecoder; 14 | unsigned char mInputBuf[kInputBufSize]; 15 | unsigned char* mNextFramePtr; 16 | int mInputLen; 17 | int mOutputLen; 18 | void initDecoder(); 19 | void freeDecoder(); 20 | void getStreamFormat(); 21 | public: 22 | virtual Codec::Type type() const { return Codec::kCodecAac; } 23 | DecoderAac(DecoderNode& parent, AudioNode& src); 24 | ~DecoderAac(); 25 | virtual StreamEvent decode(AudioNode::PacketResult& pr); 26 | virtual void reset() override; 27 | }; 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /main/decoderFlac.hpp: -------------------------------------------------------------------------------- 1 | #ifndef DECODER_FLAC_HPP 2 | #define DECODER_FLAC_HPP 3 | #include "decoderNode.hpp" 4 | #include 5 | 6 | class DecoderFlac: public Decoder 7 | { 8 | protected: 9 | enum { 10 | kMaxSamplesPerBlock = 4608, 11 | kOutputSplitMaxSamples = 2048, 12 | kMaxNumReads = 40 13 | }; 14 | typedef bool (DecoderFlac::*OutputFunc)(int nSamples, const FLAC__int32* const samples[]); 15 | int mOutputReadOfs = 0; 16 | int mNumReads = 0; 17 | DataPacket::unique_ptr mInputPacket; 18 | int mInputPos = 0; 19 | FLAC__StreamDecoder* mDecoder = nullptr; 20 | OutputFunc mOutputFunc = nullptr; 21 | AudioNode::PacketResult* mLastInputPr = nullptr; 22 | uint16_t mOutputChunkSize = 0; 23 | bool mHasOutput = false; 24 | StreamEvent mLastInputEvent = kNoError; 25 | void init(); 26 | static FLAC__StreamDecoderReadStatus readCb(const FLAC__StreamDecoder *decoder, FLAC__byte buffer[], size_t *bytes, void *client_data); 27 | static void errorCb(const FLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data); 28 | static FLAC__StreamDecoderWriteStatus writeCb(const FLAC__StreamDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 * const buffer[], void *userp); 29 | static void metadataCb(const FLAC__StreamDecoder *decoder, const FLAC__StreamMetadata *metadata, void *client_data); 30 | template 31 | bool outputSamples(int nSamples, const FLAC__int32* const samples[]); 32 | bool selectOutputFunc(int nChans, int bps); 33 | public: 34 | virtual Codec::Type type() const { return Codec::kCodecFlac; } 35 | DecoderFlac(DecoderNode& parent, AudioNode& src, bool oggMode); 36 | ~DecoderFlac(); 37 | virtual StreamEvent decode(AudioNode::PacketResult& dpr); 38 | virtual void reset(); 39 | }; 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /main/decoderMp3.hpp: -------------------------------------------------------------------------------- 1 | #ifndef DECODER_MP3_HPP 2 | #define DECODER_MP3_HPP 3 | #include "decoderNode.hpp" 4 | #include 5 | 6 | class DecoderMp3: public Decoder 7 | { 8 | protected: 9 | enum { 10 | kInputBufSize = 4096, 11 | kSamplesPerFrame = 1152, 12 | kOutputFrameSize = kSamplesPerFrame * 4 // each mp3 packet decodes to 1152 samples, for 16 bit stereo, multiply by 4 13 | }; 14 | struct mad_stream mMadStream; 15 | struct mad_frame mMadFrame; 16 | struct mad_synth mMadSynth; 17 | unsigned char mInputBuf[kInputBufSize]; 18 | int mInputLen = 0; 19 | StreamEvent output(const mad_pcm& pcm); 20 | void initMadState(); 21 | void freeMadState(); 22 | void logEncodingInfo(); 23 | void reset(); 24 | public: 25 | virtual Codec::Type type() const { return Codec::kCodecMp3; } 26 | DecoderMp3(DecoderNode& parent, AudioNode& src); 27 | virtual ~DecoderMp3(); 28 | virtual StreamEvent decode(AudioNode::PacketResult& dpr); 29 | }; 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /main/decoderVorbis.hpp: -------------------------------------------------------------------------------- 1 | #ifndef DECODER_VORBIS_HPP 2 | #define DECODER_VORBIS_HPP 3 | 4 | #include "decoderNode.hpp" 5 | #define VORB_DEBUG 6 | #define vorb_err(...) ESP_LOGE("vorbhl", ##__VA_ARGS__) 7 | #define vorb_dbg(...) ESP_LOGD("vorbhl", ##__VA_ARGS__) 8 | #include "vorbisHighLevel.hpp" 9 | 10 | class DecoderVorbis: public Decoder 11 | { 12 | protected: 13 | enum { kInitChunkSize = 16384, kTargetOutputSamples = 2048 }; 14 | VorbisDecoder mVorbis; 15 | StreamFormat getOutputFormat(); 16 | StreamEvent reinit(AudioNode::PacketResult& pr, bool isInitial); 17 | 18 | public: 19 | virtual Codec::Type type() const { return Codec::kCodecVorbis; } 20 | DecoderVorbis(DecoderNode& parent, AudioNode& src); 21 | virtual StreamEvent decode(AudioNode::PacketResult& pr); 22 | virtual void reset() override; 23 | }; 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /main/decoderWav.hpp: -------------------------------------------------------------------------------- 1 | #ifndef DECODER_WAV_HPP 2 | #define DECODER_WAV_HPP 3 | 4 | #include "decoderNode.hpp" 5 | class DecoderWav: public Decoder 6 | { 7 | protected: 8 | typedef bool(DecoderWav::*OutputFunc)(char* data, int len); 9 | typedef void(DecoderWav::*OutputInSituFunc)(DataPacket& input); 10 | OutputFunc mOutputFunc = nullptr; 11 | OutputInSituFunc mOutputInSituFunc = nullptr; 12 | char mPartialInSampleBuf[8]; 13 | int8_t mPartialInSampleBytes = 0; 14 | int8_t mInBytesPerSample = 0; 15 | int8_t mNumChans = 0; // cached from outputFormat for faster access 16 | int parseWavHeader(DataPacket& pkt); 17 | bool setupOutput(); 18 | template 19 | void selectOutput16or32(); 20 | template 21 | bool outputWithNewPacket(char* input, int len); 22 | template 23 | void outputSwapBeToLeInSitu(DataPacket& pkt); 24 | void outputNoChange(DataPacket& pkt) {} 25 | public: 26 | virtual Codec::Type type() const { return outputFormat.codec().type; } 27 | DecoderWav(DecoderNode& parent, AudioNode& src, StreamFormat fmt); 28 | virtual ~DecoderWav() {} 29 | virtual StreamEvent decode(AudioNode::PacketResult& output); 30 | virtual void reset() {} 31 | }; 32 | #endif 33 | -------------------------------------------------------------------------------- /main/detectorOgg.hpp: -------------------------------------------------------------------------------- 1 | #ifndef DETECTOR_OGG_HPP 2 | #define DETECTOR_OGG_HPP 3 | 4 | #include "streamPackets.hpp" 5 | 6 | #pragma pack(push, 1) 7 | struct OggPageHeader { 8 | uint32_t fourCC; 9 | uint8_t version; 10 | uint8_t hdrType; 11 | uint64_t granulePos; 12 | uint32_t serial; 13 | uint32_t pageSeqNo; 14 | uint32_t checksum; 15 | uint8_t numSegments; 16 | uint8_t segmentLens[]; 17 | }; 18 | #pragma pack(pop) 19 | 20 | enum { kMaxNumSegments = 10 }; 21 | 22 | uint32_t fourccLittleEndian(const char* str) 23 | { 24 | return *str | (*(str+1) << 8) | (*(str+2) << 16) | (*(str+3) << 24); 25 | } 26 | 27 | StreamEvent detectOggCodec(DataPacket& dataPkt, Codec& codec) 28 | { 29 | enum { kPrefetchAmount = sizeof(OggPageHeader) + kMaxNumSegments + 10 }; // we need the first ~7 bytes in the segment 30 | if (dataPkt.dataLen < kPrefetchAmount) { 31 | ESP_LOGW("OGG", "Data packet is smaller than stream header - codec detection failed"); 32 | return kErrDecode; 33 | } 34 | OggPageHeader& hdr = *((OggPageHeader*)dataPkt.data); 35 | if (hdr.fourCC != fourccLittleEndian("OggS")) { 36 | ESP_LOGW("OGG", "Fourcc %lx doesn't match 'OggS' (%lx)", hdr.fourCC, fourccLittleEndian("OggS")); 37 | return kErrDecode; 38 | } 39 | if (hdr.numSegments > kMaxNumSegments) { 40 | ESP_LOGW("OGG", "More than expected segments in Ogg page: %d", hdr.numSegments); 41 | return kErrDecode; 42 | } 43 | const char* magic = dataPkt.data + sizeof(OggPageHeader) + hdr.numSegments + 1; 44 | if (strncmp(magic, "FLAC", 4) == 0) { 45 | codec.type = Codec::kCodecFlac; 46 | } else if (strncmp(magic, "vorbis", 7) == 0) { 47 | codec.type = Codec::kCodecVorbis; 48 | } else { 49 | ESP_LOGW("OGG", "Unrecognized codec magic signature in OGG transport stream"); 50 | codec.type = Codec::kCodecUnknown; 51 | return kErrNoCodec; 52 | } 53 | return kNoError; 54 | } 55 | 56 | #endif 57 | -------------------------------------------------------------------------------- /main/dlna-parse.hpp: -------------------------------------------------------------------------------- 1 | #ifndef DLNA_PARSE_H 2 | #define DLNA_PARSE_H 3 | #include 4 | #include 5 | #include 6 | 7 | extern const char* kZeroHmsTime; 8 | namespace tinyxml2 { 9 | class XMLElement; 10 | class XMLNode; 11 | } 12 | const tinyxml2::XMLElement* xmlFindPath(const tinyxml2::XMLNode* node, const char* path); 13 | static inline const char* xmlFindPathGetText(const tinyxml2::XMLNode* node, const char* path) 14 | { 15 | auto elem = xmlFindPath(node, path); 16 | return elem ? elem->GetText() : nullptr; 17 | } 18 | static inline const char* xmlGetChildText(const tinyxml2::XMLElement& elem, const char* childName, bool logNotFound=true) 19 | { 20 | auto child = elem.FirstChildElement(childName); 21 | if (!child) { 22 | if (logNotFound) { 23 | ESP_LOGW("DLNA", "%s: Child node %s not found", elem.Name(), childName); 24 | } 25 | return nullptr; 26 | } 27 | auto result = child->GetText(); 28 | if (!result && logNotFound) { 29 | ESP_LOGW("DLNA", "%s: Child node %s has no contents", elem.Name(), childName); 30 | } 31 | return result; 32 | } 33 | 34 | static inline const char* xmlGetChildAttr(const tinyxml2::XMLElement& elem, const char* childName, const char* attrName) 35 | { 36 | auto child = elem.FirstChildElement(childName); 37 | if (!child) { 38 | return nullptr; 39 | } 40 | return child->Attribute(attrName); 41 | } 42 | 43 | std::string msToHmsString(uint32_t ms); 44 | uint32_t parseHmsTime(const char* hms); 45 | 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /main/exceptions.hpp: -------------------------------------------------------------------------------- 1 | #ifndef NETPLAYER_EXCEPTION_H 2 | #define NETPLAYER_EXCEPTION_H 3 | #include 4 | 5 | class MyException: public std::exception 6 | { 7 | protected: 8 | char* mMessage; 9 | int mCode; 10 | public: 11 | MyException(const char* msg, int code=0) 12 | : mMessage(msg ? strdup(msg) : nullptr), mCode(code) 13 | {} 14 | ~MyException() { free(mMessage); } 15 | const char* what() const noexcept override { return mMessage; } 16 | int code() const { return mCode; } 17 | MyException& operator=(const MyException& other) 18 | { 19 | mCode = other.mCode; 20 | free(mMessage); 21 | mMessage = strdup(other.mMessage); 22 | return *this; 23 | } 24 | }; 25 | #endif 26 | -------------------------------------------------------------------------------- /main/font_Icons22.cpp: -------------------------------------------------------------------------------- 1 | /* Vertical-scan bitmap data for font Icons22 (21x19) 2 | * Defines ASCII characters from 32 to 34 3 | * Generated with lcdfont utility by Alexander Vassilev 4 | */ 5 | #include 6 | static const unsigned char _font_Icons22_data[] = { 7 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // blank (32) 8 | 0x00,0x00,0x00,0xf8,0x01,0x00,0xfc,0x07,0x00,0xfe,0x0f,0x00,0xff,0x1f,0x00,0xff,0x3f,0x00,0xff,0x7f,0x00,0xff,0xff,0x00,0xfe,0xff,0x01,0xfe,0xff,0x03,0xfc,0xff,0x07,0xfc,0xff,0x07,0xfe,0xff,0x03,0xfe,0xff,0x01,0xff,0xff,0x00,0xff,0x7f,0x00,0xff,0x3f,0x00,0xff,0x1f,0x00,0xfe,0x0f,0x00,0xfc,0x07,0x00,0xf8,0x01,0x00, // heart (33) 9 | 0xf8,0x3f,0x00,0x04,0x40,0x00,0xe2,0x9f,0x00,0x12,0x83,0x00,0x12,0x85,0x00,0x12,0x89,0x00,0xe2,0x90,0x00,0x02,0x80,0x00,0xe2,0x8f,0x00,0x12,0x91,0x00,0x12,0x91,0x00,0x12,0x91,0x00,0x12,0x90,0x00,0x02,0x80,0x00,0xe2,0x8f,0x00,0x12,0x90,0x00,0x12,0x90,0x00,0x12,0x90,0x00,0x12,0x90,0x00,0x04,0x40,0x00,0xf8,0x3f,0x00, // rec (34) 10 | }; 11 | // (isVertical, width, height, count, charSpacing, lineSpacing, data, offsets) 12 | extern Font const font_Icons22(true, 21, 19, 3, 1, 1, _font_Icons22_data, nullptr); 13 | -------------------------------------------------------------------------------- /main/icyParser.hpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | class IcyInfo 4 | { 5 | protected: 6 | unique_ptr_mfree mTrackName; 7 | unique_ptr_mfree mStaName; 8 | unique_ptr_mfree mStaDesc; 9 | unique_ptr_mfree mStaGenre; 10 | unique_ptr_mfree mStaUrl; 11 | Mutex& mInfoMutex; 12 | public: 13 | IcyInfo(Mutex& mutex): mInfoMutex(mutex) {} 14 | void clearIcyInfo(); 15 | const char* trackName() const { return mTrackName.get(); } 16 | const char* staName() const { return mStaName.get(); } 17 | const char* staDesc() const { return mStaDesc.get(); } 18 | const char* staGenre() const { return mStaGenre.get(); } 19 | const char* staUrl() const { return mStaUrl.get(); } 20 | }; 21 | 22 | class IcyParser: public IcyInfo 23 | { 24 | protected: 25 | // stream state 26 | int32_t mIcyCtr = 0; 27 | int32_t mIcyInterval = 0; 28 | int16_t mIcyRemaining = 0; 29 | DynBuffer mIcyMetaBuf; 30 | void parseIcyData(); // we extract only StreamTitle 31 | public: 32 | IcyParser(Mutex& infoMutex): IcyInfo(infoMutex) {} 33 | int32_t icyInterval() const { return mIcyInterval; } 34 | int32_t bytesSinceLastMeta() const { return mIcyCtr; } 35 | void reset(); 36 | bool parseHeader(const char* key, const char* value); 37 | bool processRecvData(char* buf, int& rlen); 38 | }; 39 | -------------------------------------------------------------------------------- /main/playlist.hpp: -------------------------------------------------------------------------------- 1 | #ifndef PLAYLIST_HPP 2 | #define PLAYLIST_HPP 3 | #include 4 | #include 5 | 6 | class Playlist: public std::vector 7 | { 8 | typedef std::vector Base; 9 | uint16_t mNextTrack = 0; 10 | char* readLine(char*& start); 11 | bool handlePls(); 12 | public: 13 | void clear(); 14 | void load(char* data); 15 | const char* getNextTrack(); 16 | }; 17 | 18 | #endif // PLAYLIST_HPP 19 | -------------------------------------------------------------------------------- /main/recorder.hpp: -------------------------------------------------------------------------------- 1 | #ifndef TRACK_RECORDER_HPP 2 | #define TRACK_RECORDER_HPP 3 | #include 4 | #include 5 | #include "audioNode.hpp" 6 | 7 | class TrackRecorder 8 | { 9 | protected: 10 | std::string mRootPath; 11 | std::string mStationName; 12 | std::string mCurrTrackName; 13 | FILE* mSinkFile = nullptr; 14 | bool mLastNotifiedRec = false; 15 | void commit(); 16 | std::string sinkFileName() const { return mRootPath + "/stream.dat"; } 17 | std::string trackNameToPath(const std::string& trackName) const; 18 | bool createDirIfNotExist(const char* dirname) const; 19 | public: 20 | TrackRecorder(const char* rootPath); 21 | ~TrackRecorder() { abortTrack(); } 22 | void setStation(const char* name); 23 | bool onNewTrack(const char* trackName, Codec codec); 24 | void onData(const void* data, int dataLen); 25 | void abortTrack(); 26 | bool isRecording() const { return mSinkFile != nullptr; } 27 | }; 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /main/speedProbe.hpp: -------------------------------------------------------------------------------- 1 | #ifndef SPEEDPROBE_HPP 2 | #define SPEEDPROBE_HPP 3 | 4 | class LinkSpeedProbe { 5 | ElapsedTimer mTimer; 6 | uint32_t mBytes = 0; 7 | uint32_t mAvgSpeed = 0; 8 | public: 9 | uint32_t average() const { return mAvgSpeed; } 10 | void onTraffic(uint32_t nBytes) { mBytes += nBytes; } 11 | void reset() { mBytes = 0; mAvgSpeed = 0; mTimer.reset(); } 12 | uint32_t poll() { 13 | int64_t elapsed = mTimer.usElapsed(); 14 | mTimer.reset(); 15 | if (elapsed == 0) { 16 | elapsed = 1; 17 | } 18 | uint32_t speed = ((int64_t)mBytes * 1000000 + (elapsed >> 1)) / elapsed; //rounded int division 19 | mBytes = 0; 20 | mAvgSpeed = (mAvgSpeed * 3 + speed + 2) >> 2; // rounded int division by 4 21 | return speed; 22 | } 23 | }; 24 | 25 | #endif // SPEEDPROBE_HPP 26 | -------------------------------------------------------------------------------- /main/vuDisplay.hpp: -------------------------------------------------------------------------------- 1 | #ifndef VU_DISPLAY_H 2 | #define VU_DISPLAY_H 3 | #include 4 | #include 5 | #include "volume.hpp" 6 | #include 7 | 8 | template 9 | class FrameBuffer; 10 | template 11 | class Gfx; 12 | typedef Gfx> LcdFrameBuf; 13 | 14 | class NvsHandle; 15 | 16 | class VuDisplay { 17 | enum { 18 | kLevelSmoothFactor = 4, kDefPeakHoldMs = 30, kDefPeakDropSpeed = 20, 19 | kDefLedWidth = 1, kDefLedHeight = 10, kDefLedSpacing = 1, kDefChanSpacing = 2 20 | }; 21 | enum: uint16_t { 22 | kLevelMax = std::numeric_limits::max(), 23 | kDefYellowThresh = kLevelMax - 512 24 | }; 25 | struct ChanCtx 26 | { 27 | int16_t barY; 28 | int16_t avgLevel; 29 | int16_t peakLevel; 30 | uint8_t peakTimer; 31 | void reset() { avgLevel = peakLevel = peakTimer = 0; } 32 | ChanCtx() { reset(); } 33 | }; 34 | LcdFrameBuf& mLcd; 35 | ChanCtx mLeftCtx; 36 | ChanCtx mRightCtx; 37 | int8_t mStepWidth; // mLedWidth + led spacing 38 | int8_t mLedWidth; 39 | int8_t mLedHeight; 40 | int8_t mChanSpacing; 41 | int16_t mYellowStartX; 42 | Color565 mGreenColor; 43 | Color565 mYellowColor; 44 | int32_t mLevelPerLed; 45 | uint8_t mPeakDropTicks; 46 | uint8_t mPeakHoldTicks; 47 | uint8_t mHeight; 48 | inline Color565 ledColor(int16_t ledX, int16_t level); 49 | void calculateLevels(ChanCtx& ctx, int16_t level); 50 | void drawChannel(ChanCtx& ctx, int16_t level); 51 | inline int16_t numLedsForLevel(int16_t level); 52 | public: 53 | VuDisplay(LcdFrameBuf& lcd): mLcd(lcd) {} 54 | void init(NvsHandle& nvs); 55 | void update(const IAudioVolume::StereoLevels& levels); 56 | void reset(NvsHandle& nvs); 57 | int16_t height() const { return mHeight; } 58 | }; 59 | 60 | #endif 61 | -------------------------------------------------------------------------------- /ota.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | source `dirname "$0"`/esp-host.sh 5 | RETRY="--retry 20 --retry-connrefused --connect-timeout 1 --retry-delay 1" 6 | 7 | ISRECOVERY=`curl -s -S $RETRY -o /dev/null -w "%{http_code}" http://${ESP_HOST}:80/isrecovery` 8 | if [ "$ISRECOVERY" != "200" ]; then 9 | echo -n "Rebooting to recovery..." 10 | RECOVERY_URL="http://${ESP_HOST}:80/reboot?recovery=1" 11 | if [ "$1" == "make" ]; then 12 | RECOVERY_URL+="&flags=1" 13 | fi 14 | curl -s -S $RETRY "$RECOVERY_URL" 15 | echo 16 | if [ "$1" == "make" ]; then 17 | ninja 18 | else 19 | echo "Waiting target to reconnect..." 20 | sleep 3 21 | fi 22 | else 23 | # already in recovery 24 | if [ "$1" == "make" ]; then 25 | ninja 26 | fi 27 | echo "Target is already in recovery mode, not rebooting" 28 | fi 29 | 30 | ELF_FILE=$(ls ./*.elf) 31 | if [ -z "$ELF_FILE" ]; then 32 | echo "No .elf file present in current directory" 33 | exit 1 34 | fi 35 | BIN_FILE="$(basename -s .elf $ELF_FILE).bin" 36 | echo binfile=$BIN_FILE 37 | if [ ! -f "$BIN_FILE" ]; then 38 | echo "No .bin file present in current directory" 39 | exit 1 40 | fi 41 | 42 | echo "Erasing flash and sending image $BIN_FILE ($((`stat --printf="%s" $BIN_FILE` / 1024))KB)..." 43 | curl $RETRY -i -X POST ${ESP_HOST}:80/ota -H "Content-Type: application/octet-stream" --data-binary "@$BIN_FILE" --progress-bar > /dev/null 44 | 45 | if [ "$?" -eq 0 ]; then 46 | echo Success, reboting.... 47 | else 48 | echo Failed 49 | exit 1 50 | fi 51 | 52 | if [ "$1" == "make" ] && [ "$2" == "log" ]; then 53 | nc $ESPLINK_HOST 23 54 | fi 55 | -------------------------------------------------------------------------------- /partitions.csv: -------------------------------------------------------------------------------- 1 | # Name, Type, SubType, Offset, Size, Flags 2 | nvs, data, nvs, 0x9000, 16K 3 | otadata, data, ota, , 8K 4 | phy_init, data, phy, , 4K 5 | storage, data, spiffs, , 320K 6 | recovery, app, factory, , 768K 7 | app, app, ota_0, 0x120000, 2944K 8 | -------------------------------------------------------------------------------- /partoffset.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | import csv 3 | import sys 4 | 5 | def parse_size(size_str): 6 | """Convert size like '320K', '1M', or '0x1000' to bytes.""" 7 | size_str = size_str.strip().upper() 8 | if size_str.endswith('K'): 9 | return int(size_str[:-1], 0) * 1024 10 | elif size_str.endswith('M'): 11 | return int(size_str[:-1], 0) * 1024 * 1024 12 | return int(size_str, 0) 13 | 14 | def find_partition_offset(csv_file, target_name): 15 | computed_offset = None 16 | first_partition = True 17 | 18 | with open(csv_file, newline='') as f: 19 | reader = csv.reader(f) 20 | for row in reader: 21 | if not row or row[0].strip().startswith('#'): 22 | continue 23 | 24 | fields = [cell.strip() for cell in row] 25 | if len(fields) < 5: 26 | raise ValueError(f"Malformed row: {row}") 27 | 28 | name, _, _, raw_offset, size_str = fields[:5] 29 | size = parse_size(size_str) 30 | 31 | if first_partition: 32 | if not raw_offset: 33 | raise ValueError("First partition must have an explicit offset.") 34 | computed_offset = int(raw_offset, 0) 35 | first_partition = False 36 | else: 37 | if raw_offset: 38 | explicit_offset = int(raw_offset, 0) 39 | if explicit_offset != computed_offset: 40 | raise ValueError( 41 | f"Offset mismatch for partition '{name}': " 42 | f"expected 0x{computed_offset:X}, got 0x{explicit_offset:X}" 43 | ) 44 | 45 | if name == target_name: 46 | return hex(computed_offset) 47 | 48 | computed_offset += size 49 | 50 | raise ValueError(f"Partition '{target_name}' not found.") 51 | 52 | if __name__ == "__main__": 53 | if len(sys.argv) != 3: 54 | print("Get partition offset from a partitions.csv file\nUsage: partoffs.py ", file=sys.stderr) 55 | sys.exit(1) 56 | 57 | csv_file = sys.argv[1] 58 | partition_name = sys.argv[2] 59 | 60 | try: 61 | offset = find_partition_offset(csv_file, partition_name) 62 | print(offset) 63 | except Exception as e: 64 | print(f"Error: {e}", file=sys.stderr) 65 | sys.exit(1) 66 | -------------------------------------------------------------------------------- /recovery/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # The following five lines of boilerplate have to be in your project's 2 | # CMakeLists in this exact order for cmake to work correctly 3 | cmake_minimum_required(VERSION 3.16) 4 | 5 | include($ENV{IDF_PATH}/tools/cmake/project.cmake) 6 | project(recovery) 7 | -------------------------------------------------------------------------------- /recovery/components/httpLib: -------------------------------------------------------------------------------- 1 | ../../esp32-mylibs/httpLib -------------------------------------------------------------------------------- /recovery/components/mySystem: -------------------------------------------------------------------------------- 1 | ../../esp32-mylibs/mySystem -------------------------------------------------------------------------------- /recovery/components/st7735: -------------------------------------------------------------------------------- 1 | ../../components/st7735 -------------------------------------------------------------------------------- /recovery/main/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | idf_component_register(SRCS main.cpp font_Camingo22.cpp INCLUDE_DIRS "." REQUIRES app_update st7735 mySystem) 2 | -------------------------------------------------------------------------------- /recovery/main/font_Camingo22.cpp: -------------------------------------------------------------------------------- 1 | ../../main/font_Camingo22.cpp -------------------------------------------------------------------------------- /recovery/main/font_Camingo32.cpp: -------------------------------------------------------------------------------- 1 | ../../main/font_Camingo32.cpp -------------------------------------------------------------------------------- /recovery/main/rtcSharedMem.hpp: -------------------------------------------------------------------------------- 1 | #ifndef RTC_SHARED_MEM_HPP 2 | #define RTC_SHARED_MEM_HPP 3 | // This file should be included only once, as it defines variables 4 | 5 | enum { kRecoveryFlagEraseImmediately = 1, kRecoveryFlagsInvalid = 0xffffffff }; 6 | enum: uint32_t { kRecoveryFlagsChecksumKey = 0xcafebabe }; 7 | 8 | #define RTC_SHARED_MEM ((uint32_t*)SOC_RTC_DATA_LOW) 9 | static constexpr uint32_t RECOVERY_FLAGS_RTCMEM_LOCATION = 123; 10 | uint32_t& gRecoveryFlags = RTC_SHARED_MEM[RECOVERY_FLAGS_RTCMEM_LOCATION]; 11 | uint32_t& gRecoveryFlagsChecksum = RTC_SHARED_MEM[RECOVERY_FLAGS_RTCMEM_LOCATION + 1]; 12 | 13 | void recoveryWriteFlags(uint32_t flags) 14 | { 15 | gRecoveryFlags = flags; 16 | gRecoveryFlagsChecksum = flags ^ kRecoveryFlagsChecksumKey; 17 | } 18 | uint32_t recoveryReadAndInvalidateFlags() 19 | { 20 | auto flags = gRecoveryFlags; 21 | auto checksum = gRecoveryFlagsChecksum; 22 | gRecoveryFlags = 0; 23 | gRecoveryFlagsChecksum = 0; 24 | return ((flags ^ kRecoveryFlagsChecksumKey) == checksum) ? flags : (uint32_t)kRecoveryFlagsInvalid; 25 | } 26 | 27 | #endif 28 | 29 | -------------------------------------------------------------------------------- /recovery/partitions.csv: -------------------------------------------------------------------------------- 1 | ../partitions.csv -------------------------------------------------------------------------------- /staexport.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | if [ -z "$1" ]; then 5 | echo "Export radio station list to JSON file" 6 | echo "Usage:" 7 | echo "$0 " 8 | exit 1 9 | fi 10 | 11 | curl http://netplayer.local/slist?a=dump -o "$1" 12 | -------------------------------------------------------------------------------- /staimport.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | source ./esp-host.sh 3 | curl -i -X POST ${ESP_HOST}:80/slist/import -H "Content-Type: text/json" --data-binary "@$1" 4 | -------------------------------------------------------------------------------- /wup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | source ./esp-host.sh 3 | curl -i -X POST ${ESP_HOST}:80/file/spiffs/$1 -H "Content-Type: text/html" --data-binary "@www/$1" 4 | --------------------------------------------------------------------------------