Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

changes to support libshout v2.4.6 #382

Merged
merged 4 commits into from
Jul 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 23 additions & 2 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,12 @@ list(APPEND link_dirs ${SHOUT_LIBRARY_DIRS})

set(CMAKE_REQUIRED_INCLUDES_SAVE ${CMAKE_REQUIRED_INCLUDES})
set(CMAKE_REQUIRED_LIBRARIES_SAVE ${CMAKE_REQUIRED_LIBRARIES})
set(CMAKE_REQUIRED_LINK_OPTIONS_SAVE ${CMAKE_REQUIRED_LINK_OPTIONS})
set(CMAKE_REQUIRED_INCLUDES "${CMAKE_REQUIRED_INCLUDES} ${SHOUT_INCLUDE_DIRS}")
set(CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES}
${SHOUT_LIBRARIES}")
set(CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES} ${SHOUT_LIBRARIES}")
if ( NOT "${SHOUT_LIBRARY_DIRS}" STREQUAL "" )
set(CMAKE_REQUIRED_LINK_OPTIONS "-L${SHOUT_LIBRARY_DIRS}")
endif()
set(LIBSHOUT_HEADER "shout/shout.h")
CHECK_CXX_SYMBOL_EXISTS("SHOUT_TLS_AUTO" ${LIBSHOUT_HEADER}
HAVE_SHOUT_TLS_AUTO)
Expand All @@ -91,8 +94,26 @@ if(HAVE_SHOUT_TLS_AUTO AND HAVE_SHOUT_TLS_AUTO_NO_PLAIN AND
else()
set(LIBSHOUT_HAS_TLS FALSE)
endif()

# check for shout_set_metadata_utf8() - introduced in libshout v2.4.6
CHECK_CXX_SYMBOL_EXISTS("shout_set_metadata_utf8" ${LIBSHOUT_HEADER}
HAVE_SHOUT_SET_METADATA_UTF8)
if(HAVE_SHOUT_SET_METADATA_UTF8)
set(SHOUT_SET_METADATA "shout_set_metadata_utf8")
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})

option(NFM "Enable support for narrow FM channels" OFF)

Expand Down
3 changes: 3 additions & 0 deletions src/config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,7 @@
#cmakedefine WITH_BCM_VC
#cmakedefine LIBSHOUT_HAS_TLS
#define SINCOSF @SINCOSF@

#define SHOUT_SET_METADATA @SHOUT_SET_METADATA@

#endif // !_CONFIG_H
10 changes: 5 additions & 5 deletions src/output.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,16 +78,16 @@ void shout_setup(icecast_data *icecast, mix_modes mixmode) {
if (shout_set_password(shouttemp, icecast->password) != SHOUTERR_SUCCESS) {
shout_free(shouttemp); return;
}
if (shout_set_format(shouttemp, SHOUT_FORMAT_MP3) != SHOUTERR_SUCCESS){
if (shout_set_content_format(shouttemp, SHOUT_FORMAT_MP3, SHOUT_USAGE_AUDIO, NULL) != SHOUTERR_SUCCESS){
shout_free(shouttemp); return;
}
if(icecast->name && shout_set_name(shouttemp, icecast->name) != SHOUTERR_SUCCESS) {
if(icecast->name && shout_set_meta(shouttemp, SHOUT_META_NAME, icecast->name) != SHOUTERR_SUCCESS) {
shout_free(shouttemp); return;
}
if(icecast->genre && shout_set_genre(shouttemp, icecast->genre) != SHOUTERR_SUCCESS) {
if(icecast->genre && shout_set_meta(shouttemp, SHOUT_META_GENRE, icecast->genre) != SHOUTERR_SUCCESS) {
shout_free(shouttemp); return;
}
if(icecast->description && shout_set_description(shouttemp, icecast->description) != SHOUTERR_SUCCESS) {
if(icecast->description && shout_set_meta(shouttemp, SHOUT_META_DESCRIPTION, icecast->description) != SHOUTERR_SUCCESS) {
shout_free(shouttemp); return;
}
char samplerates[20];
Expand Down Expand Up @@ -476,7 +476,7 @@ void process_outputs(channel_t *channel, int cur_scan_freq) {
log(LOG_WARNING, "Failed to add shout metadata\n");
}
}
if (shout_set_metadata(icecast->shout, meta) != SHOUTERR_SUCCESS) {
if (SHOUT_SET_METADATA(icecast->shout, meta) != SHOUTERR_SUCCESS) {
log(LOG_WARNING, "Failed to add shout metadata\n");
}
shout_metadata_free(meta);
Expand Down