Skip to content

Commit

Permalink
Build with libshout 2.4.1 (#422)
Browse files Browse the repository at this point in the history
* return support for libshout v2.4.1 (last version in apt for Raspbian Buster)

* add check to make sure old config.h does not exist
  • Loading branch information
charlie-foxtrot authored Oct 14, 2023
1 parent 471abcf commit c0795df
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ CHECK_CXX_SYMBOL_EXISTS("SHOUT_TLS_DISABLED" ${LIBSHOUT_HEADER}
HAVE_SHOUT_TLS_DISABLED)
CHECK_CXX_SYMBOL_EXISTS("shout_set_tls" ${LIBSHOUT_HEADER}
HAVE_SHOUT_SET_TLS)
CHECK_CXX_SYMBOL_EXISTS("shout_set_content_format" ${LIBSHOUT_HEADER}
LIBSHOUT_HAS_CONTENT_FORMAT)

if(HAVE_SHOUT_TLS_AUTO AND HAVE_SHOUT_TLS_AUTO_NO_PLAIN AND
HAVE_SHOUT_TLS_RFC2818 AND HAVE_SHOUT_TLS_RFC2817 AND
HAVE_SHOUT_TLS_DISABLED AND HAVE_SHOUT_SET_TLS)
Expand All @@ -104,13 +107,6 @@ else()
set(SHOUT_SET_METADATA "shout_set_metadata")
endif()

# check for shout_set_content_format() - introduced in libshout v2.4.3
CHECK_CXX_SYMBOL_EXISTS("shout_set_content_format" ${LIBSHOUT_HEADER}
HAVE_SHOUT_SET_CONTENT_FORMAT)
if(NOT HAVE_SHOUT_SET_CONTENT_FORMAT)
message(FATAL_ERROR "Required function shout_set_content_format() is unavailable, libshout v2.4.3 or later required")
endif()

set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES_SAVE})
set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES_SAVE})
set(CMAKE_REQUIRED_LINK_OPTIONS ${CMAKE_REQUIRED_LINK_OPTIONS_SAVE})
Expand Down Expand Up @@ -275,6 +271,10 @@ message(STATUS " - PulseAudio:\t\trequested: ${PULSEAUDIO}, enabled: ${WITH_PUL
message(STATUS " - Profiling:\t\trequested: ${PROFILING}, enabled: ${WITH_PROFILING}")
message(STATUS " - Icecast TLS support:\t${LIBSHOUT_HAS_TLS}")

if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/config.h)
message(FATAL_ERROR "${CMAKE_CURRENT_SOURCE_DIR}/config.h nolonger used, delete before continuing")
endif()

configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/config.h.in"
"${CMAKE_CURRENT_BINARY_DIR}/config.h"
Expand Down
1 change: 1 addition & 0 deletions src/config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#cmakedefine NFM
#cmakedefine WITH_BCM_VC
#cmakedefine LIBSHOUT_HAS_TLS
#cmakedefine LIBSHOUT_HAS_CONTENT_FORMAT
#define SINCOSF @SINCOSF@

#define SHOUT_SET_METADATA @SHOUT_SET_METADATA@
Expand Down
4 changes: 4 additions & 0 deletions src/output.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,11 @@ void shout_setup(icecast_data *icecast, mix_modes mixmode) {
if (shout_set_password(shouttemp, icecast->password) != SHOUTERR_SUCCESS) {
shout_free(shouttemp); return;
}
#ifdef LIBSHOUT_HAS_CONTENT_FORMAT
if (shout_set_content_format(shouttemp, SHOUT_FORMAT_MP3, SHOUT_USAGE_AUDIO, NULL) != SHOUTERR_SUCCESS){
#else
if (shout_set_format(shouttemp, SHOUT_FORMAT_MP3) != SHOUTERR_SUCCESS){
#endif
shout_free(shouttemp); return;
}
if(icecast->name && shout_set_meta(shouttemp, SHOUT_META_NAME, icecast->name) != SHOUTERR_SUCCESS) {
Expand Down

0 comments on commit c0795df

Please sign in to comment.