Procházet zdrojové kódy

Ogg decoder: lynx_ prefix for the vendored libogg/libvorbis symbols (JUCE links its own copy)

Ka1-S před 1 měsícem
rodič
revize
bcff163395

+ 3 - 1
CMakeLists.txt

@@ -130,7 +130,9 @@ file(GLOB VORBIS_SOURCES third_party/vorbis/src/*.c)
 list(FILTER VORBIS_SOURCES EXCLUDE REGEX "/lookup\\.c$") # (included by lsp.c)
 add_library(vorbis_decoder STATIC ${VORBIS_SOURCES})
 target_include_directories(vorbis_decoder PUBLIC third_party/vorbis/include PRIVATE third_party/vorbis/src)
-target_compile_options(vorbis_decoder PRIVATE $<$<NOT:$<C_COMPILER_ID:MSVC>>:-ffp-contract=off -w>)
+target_compile_options(vorbis_decoder PRIVATE $<$<NOT:$<C_COMPILER_ID:MSVC>>:-ffp-contract=off -w>
+    # every symbol gets a lynx_ prefix (JUCE links its own copy with the same C names)
+    $<IF:$<C_COMPILER_ID:MSVC>,/FI${CMAKE_CURRENT_SOURCE_DIR}/third_party/vorbis/include/lynx_vorbis_prefix.h,-include${CMAKE_CURRENT_SOURCE_DIR}/third_party/vorbis/include/lynx_vorbis_prefix.h>)
 target_link_libraries(lynx_core PUBLIC vorbis_decoder)
 
 add_executable(lynx_tests tests/tests.cpp)

+ 1 - 1
scripts/build-local.sh

@@ -57,7 +57,7 @@ mkdir -p build-local/vorbis
 for f in third_party/vorbis/src/*.c; do
     [[ "$(basename "$f")" == lookup.c ]] && continue # (included by lsp.c)
     obj="build-local/vorbis/$(basename "$f" .c).o"
-    [[ -f "$obj" && "$obj" -nt "$f" ]] || $CC -c -O2 -w -ffp-contract=off -Ithird_party/vorbis/include -Ithird_party/vorbis/src "$f" -o "$obj"
+    [[ -f "$obj" && "$obj" -nt "$f" ]] || $CC -c -O2 -w -ffp-contract=off -include third_party/vorbis/include/lynx_vorbis_prefix.h -Ithird_party/vorbis/include -Ithird_party/vorbis/src "$f" -o "$obj"
 done
 WAVPACK="$WAVPACK $(ls build-local/vorbis/*.o | tr '\n' ' ')"
 $CXX $FLAGS $CORE $WAVPACK tests/tests.cpp -o build-local/lynx_tests 2> >(grep -v 'glibc version' >&2)

+ 1 - 1
scripts/build-windows-zig.sh

@@ -126,7 +126,7 @@ for f in third_party/vorbis/src/*.c; do
     [[ "$(basename "$f")" == lookup.c ]] && continue # (included by lsp.c)
     obj="$OUT/vorbis/$(basename "$f" .c).o"
     if [[ ! -f "$obj" || "$f" -nt "$obj" ]]; then
-        "$ZIG" cc -target "$TARGET" -O2 -w -ffp-contract=off -Ithird_party/vorbis/include -Ithird_party/vorbis/src -c "$f" -o "$obj"
+        "$ZIG" cc -target "$TARGET" -O2 -w -ffp-contract=off -include third_party/vorbis/include/lynx_vorbis_prefix.h -Ithird_party/vorbis/include -Ithird_party/vorbis/src -c "$f" -o "$obj"
     fi
 done
 

+ 191 - 0
third_party/vorbis/include/lynx_vorbis_prefix.h

@@ -0,0 +1,191 @@
+/* LYNX: every external symbol of this libogg/libvorbis copy gets a "lynx_" prefix, so it can be linked next to
+   the copy JUCE compiles into juce_audio_formats (same C names). Generated from the objects' symbol list. */
+#ifndef LYNX_VORBIS_PREFIX_H
+#define LYNX_VORBIS_PREFIX_H
+#define _book_maptype1_quantvals lynx__book_maptype1_quantvals
+#define _book_unquantize lynx__book_unquantize
+#define _float32_pack lynx__float32_pack
+#define _float32_unpack lynx__float32_unpack
+#define _floor_P lynx__floor_P
+#define _make_words lynx__make_words
+#define _mapping_P lynx__mapping_P
+#define _residue_P lynx__residue_P
+#define _ve_envelope_clear lynx__ve_envelope_clear
+#define _ve_envelope_init lynx__ve_envelope_init
+#define _ve_envelope_mark lynx__ve_envelope_mark
+#define _ve_envelope_search lynx__ve_envelope_search
+#define _ve_envelope_shift lynx__ve_envelope_shift
+#define _vi_gpsy_free lynx__vi_gpsy_free
+#define _vi_psy_free lynx__vi_psy_free
+#define _vorbis_apply_window lynx__vorbis_apply_window
+#define _vorbis_block_alloc lynx__vorbis_block_alloc
+#define _vorbis_block_ripcord lynx__vorbis_block_ripcord
+#define _vorbis_window_get lynx__vorbis_window_get
+#define _vp_ampmax_decay lynx__vp_ampmax_decay
+#define _vp_couple_quantize_normalize lynx__vp_couple_quantize_normalize
+#define _vp_global_free lynx__vp_global_free
+#define _vp_global_look lynx__vp_global_look
+#define _vp_noisemask lynx__vp_noisemask
+#define _vp_offset_and_mix lynx__vp_offset_and_mix
+#define _vp_psy_clear lynx__vp_psy_clear
+#define _vp_psy_init lynx__vp_psy_init
+#define _vp_tonemask lynx__vp_tonemask
+#define drft_backward lynx_drft_backward
+#define drft_clear lynx_drft_clear
+#define drft_forward lynx_drft_forward
+#define drft_init lynx_drft_init
+#define floor0_exportbundle lynx_floor0_exportbundle
+#define floor1_encode lynx_floor1_encode
+#define floor1_exportbundle lynx_floor1_exportbundle
+#define floor1_fit lynx_floor1_fit
+#define floor1_interpolate_fit lynx_floor1_interpolate_fit
+#define mapping0_exportbundle lynx_mapping0_exportbundle
+#define mdct_backward lynx_mdct_backward
+#define mdct_clear lynx_mdct_clear
+#define mdct_forward lynx_mdct_forward
+#define mdct_init lynx_mdct_init
+#define ogg_packet_clear lynx_ogg_packet_clear
+#define ogg_page_bos lynx_ogg_page_bos
+#define ogg_page_checksum_set lynx_ogg_page_checksum_set
+#define ogg_page_continued lynx_ogg_page_continued
+#define ogg_page_eos lynx_ogg_page_eos
+#define ogg_page_granulepos lynx_ogg_page_granulepos
+#define ogg_page_packets lynx_ogg_page_packets
+#define ogg_page_pageno lynx_ogg_page_pageno
+#define ogg_page_serialno lynx_ogg_page_serialno
+#define ogg_page_version lynx_ogg_page_version
+#define ogg_stream_check lynx_ogg_stream_check
+#define ogg_stream_clear lynx_ogg_stream_clear
+#define ogg_stream_destroy lynx_ogg_stream_destroy
+#define ogg_stream_eos lynx_ogg_stream_eos
+#define ogg_stream_flush lynx_ogg_stream_flush
+#define ogg_stream_flush_fill lynx_ogg_stream_flush_fill
+#define ogg_stream_init lynx_ogg_stream_init
+#define ogg_stream_iovecin lynx_ogg_stream_iovecin
+#define ogg_stream_packetin lynx_ogg_stream_packetin
+#define ogg_stream_packetout lynx_ogg_stream_packetout
+#define ogg_stream_packetpeek lynx_ogg_stream_packetpeek
+#define ogg_stream_pagein lynx_ogg_stream_pagein
+#define ogg_stream_pageout lynx_ogg_stream_pageout
+#define ogg_stream_pageout_fill lynx_ogg_stream_pageout_fill
+#define ogg_stream_reset lynx_ogg_stream_reset
+#define ogg_stream_reset_serialno lynx_ogg_stream_reset_serialno
+#define ogg_sync_buffer lynx_ogg_sync_buffer
+#define ogg_sync_check lynx_ogg_sync_check
+#define ogg_sync_clear lynx_ogg_sync_clear
+#define ogg_sync_destroy lynx_ogg_sync_destroy
+#define ogg_sync_init lynx_ogg_sync_init
+#define ogg_sync_pageout lynx_ogg_sync_pageout
+#define ogg_sync_pageseek lynx_ogg_sync_pageseek
+#define ogg_sync_reset lynx_ogg_sync_reset
+#define ogg_sync_wrote lynx_ogg_sync_wrote
+#define oggpackB_adv lynx_oggpackB_adv
+#define oggpackB_adv1 lynx_oggpackB_adv1
+#define oggpackB_bits lynx_oggpackB_bits
+#define oggpackB_bytes lynx_oggpackB_bytes
+#define oggpackB_get_buffer lynx_oggpackB_get_buffer
+#define oggpackB_look lynx_oggpackB_look
+#define oggpackB_look1 lynx_oggpackB_look1
+#define oggpackB_read lynx_oggpackB_read
+#define oggpackB_read1 lynx_oggpackB_read1
+#define oggpackB_readinit lynx_oggpackB_readinit
+#define oggpackB_reset lynx_oggpackB_reset
+#define oggpackB_write lynx_oggpackB_write
+#define oggpackB_writealign lynx_oggpackB_writealign
+#define oggpackB_writecheck lynx_oggpackB_writecheck
+#define oggpackB_writeclear lynx_oggpackB_writeclear
+#define oggpackB_writecopy lynx_oggpackB_writecopy
+#define oggpackB_writeinit lynx_oggpackB_writeinit
+#define oggpackB_writetrunc lynx_oggpackB_writetrunc
+#define oggpack_adv lynx_oggpack_adv
+#define oggpack_adv1 lynx_oggpack_adv1
+#define oggpack_bits lynx_oggpack_bits
+#define oggpack_bytes lynx_oggpack_bytes
+#define oggpack_get_buffer lynx_oggpack_get_buffer
+#define oggpack_look lynx_oggpack_look
+#define oggpack_look1 lynx_oggpack_look1
+#define oggpack_read lynx_oggpack_read
+#define oggpack_read1 lynx_oggpack_read1
+#define oggpack_readinit lynx_oggpack_readinit
+#define oggpack_reset lynx_oggpack_reset
+#define oggpack_write lynx_oggpack_write
+#define oggpack_writealign lynx_oggpack_writealign
+#define oggpack_writecheck lynx_oggpack_writecheck
+#define oggpack_writeclear lynx_oggpack_writeclear
+#define oggpack_writecopy lynx_oggpack_writecopy
+#define oggpack_writeinit lynx_oggpack_writeinit
+#define oggpack_writetrunc lynx_oggpack_writetrunc
+#define ov_ilog lynx_ov_ilog
+#define res0_free_info lynx_res0_free_info
+#define res0_free_look lynx_res0_free_look
+#define res0_inverse lynx_res0_inverse
+#define res0_look lynx_res0_look
+#define res0_pack lynx_res0_pack
+#define res0_unpack lynx_res0_unpack
+#define res1_class lynx_res1_class
+#define res1_forward lynx_res1_forward
+#define res1_inverse lynx_res1_inverse
+#define res2_class lynx_res2_class
+#define res2_forward lynx_res2_forward
+#define res2_inverse lynx_res2_inverse
+#define residue0_exportbundle lynx_residue0_exportbundle
+#define residue1_exportbundle lynx_residue1_exportbundle
+#define residue2_exportbundle lynx_residue2_exportbundle
+#define vorbis_analysis_blockout lynx_vorbis_analysis_blockout
+#define vorbis_analysis_buffer lynx_vorbis_analysis_buffer
+#define vorbis_analysis_headerout lynx_vorbis_analysis_headerout
+#define vorbis_analysis_init lynx_vorbis_analysis_init
+#define vorbis_analysis_wrote lynx_vorbis_analysis_wrote
+#define vorbis_bitrate_addblock lynx_vorbis_bitrate_addblock
+#define vorbis_bitrate_clear lynx_vorbis_bitrate_clear
+#define vorbis_bitrate_flushpacket lynx_vorbis_bitrate_flushpacket
+#define vorbis_bitrate_init lynx_vorbis_bitrate_init
+#define vorbis_bitrate_managed lynx_vorbis_bitrate_managed
+#define vorbis_block_clear lynx_vorbis_block_clear
+#define vorbis_block_init lynx_vorbis_block_init
+#define vorbis_book_clear lynx_vorbis_book_clear
+#define vorbis_book_codelen lynx_vorbis_book_codelen
+#define vorbis_book_codeword lynx_vorbis_book_codeword
+#define vorbis_book_decode lynx_vorbis_book_decode
+#define vorbis_book_decodev_add lynx_vorbis_book_decodev_add
+#define vorbis_book_decodev_set lynx_vorbis_book_decodev_set
+#define vorbis_book_decodevs_add lynx_vorbis_book_decodevs_add
+#define vorbis_book_decodevv_add lynx_vorbis_book_decodevv_add
+#define vorbis_book_encode lynx_vorbis_book_encode
+#define vorbis_book_init_decode lynx_vorbis_book_init_decode
+#define vorbis_book_init_encode lynx_vorbis_book_init_encode
+#define vorbis_comment_add lynx_vorbis_comment_add
+#define vorbis_comment_add_tag lynx_vorbis_comment_add_tag
+#define vorbis_comment_clear lynx_vorbis_comment_clear
+#define vorbis_comment_init lynx_vorbis_comment_init
+#define vorbis_comment_query lynx_vorbis_comment_query
+#define vorbis_comment_query_count lynx_vorbis_comment_query_count
+#define vorbis_commentheader_out lynx_vorbis_commentheader_out
+#define vorbis_dsp_clear lynx_vorbis_dsp_clear
+#define vorbis_granule_time lynx_vorbis_granule_time
+#define vorbis_info_blocksize lynx_vorbis_info_blocksize
+#define vorbis_info_clear lynx_vorbis_info_clear
+#define vorbis_info_init lynx_vorbis_info_init
+#define vorbis_lpc_from_data lynx_vorbis_lpc_from_data
+#define vorbis_lpc_predict lynx_vorbis_lpc_predict
+#define vorbis_lpc_to_lsp lynx_vorbis_lpc_to_lsp
+#define vorbis_lsp_to_curve lynx_vorbis_lsp_to_curve
+#define vorbis_packet_blocksize lynx_vorbis_packet_blocksize
+#define vorbis_staticbook_destroy lynx_vorbis_staticbook_destroy
+#define vorbis_staticbook_pack lynx_vorbis_staticbook_pack
+#define vorbis_staticbook_unpack lynx_vorbis_staticbook_unpack
+#define vorbis_synthesis lynx_vorbis_synthesis
+#define vorbis_synthesis_blockin lynx_vorbis_synthesis_blockin
+#define vorbis_synthesis_halfrate lynx_vorbis_synthesis_halfrate
+#define vorbis_synthesis_halfrate_p lynx_vorbis_synthesis_halfrate_p
+#define vorbis_synthesis_headerin lynx_vorbis_synthesis_headerin
+#define vorbis_synthesis_idheader lynx_vorbis_synthesis_idheader
+#define vorbis_synthesis_init lynx_vorbis_synthesis_init
+#define vorbis_synthesis_lapout lynx_vorbis_synthesis_lapout
+#define vorbis_synthesis_pcmout lynx_vorbis_synthesis_pcmout
+#define vorbis_synthesis_read lynx_vorbis_synthesis_read
+#define vorbis_synthesis_restart lynx_vorbis_synthesis_restart
+#define vorbis_synthesis_trackonly lynx_vorbis_synthesis_trackonly
+#define vorbis_version_string lynx_vorbis_version_string
+#define vorbis_window lynx_vorbis_window
+#endif

+ 2 - 0
third_party/vorbis/include/ogg/ogg.h

@@ -16,6 +16,8 @@
 #ifndef _OGG_H
 #define _OGG_H
 
+#include "../lynx_vorbis_prefix.h" /* LYNX modification: prefixed symbols */
+
 #ifdef __cplusplus
 extern "C" {
 #endif