mirror of
https://github.com/Goldenkrew3000/OSSP_OpenSource.git
synced 2026-02-16 04:05:18 +10:00
Started implementing local music playback
This commit is contained in:
@@ -12,6 +12,8 @@ find_package(OpenGL REQUIRED)
|
||||
find_package(SDL2 REQUIRED)
|
||||
find_package(PkgConfig REQUIRED)
|
||||
pkg_check_modules(GSTREAMER REQUIRED gstreamer-1.0)
|
||||
pkg_check_modules(AVFORMAT REQUIRED libavformat)
|
||||
pkg_check_modules(AVUTIL REQUIRED libavutil)
|
||||
|
||||
add_subdirectory(external/discord-rpc)
|
||||
|
||||
@@ -25,6 +27,8 @@ add_executable(ossp MACOSX_BUNDLE
|
||||
configHandler.c
|
||||
discordrpc.c
|
||||
localRadioDBHandler.c
|
||||
localMusicHandler.cpp
|
||||
socket.c
|
||||
gui/gui_entry.cpp
|
||||
player/player.c
|
||||
player/playQueue.cpp
|
||||
@@ -65,6 +69,6 @@ set_target_properties(ossp PROPERTIES
|
||||
MACOSX_BUNDLE_GUI_IDENTIFIER "org.hojuix.ossp"
|
||||
)
|
||||
|
||||
include_directories(${GSTREAMER_INCLUDE_DIRS})
|
||||
include_directories(${GSTREAMER_INCLUDE_DIRS} ${AVFORMAT_INCLUDE_DIR} ${AVUTIL_INCLUDE_DIRS})
|
||||
|
||||
target_link_libraries(ossp PRIVATE OpenSSL::SSL OpenSSL::Crypto CURL::libcurl SDL2::SDL2 ${OPENGL_LIBRARIES} discord-rpc ${GSTREAMER_LIBRARIES})
|
||||
target_link_libraries(ossp PRIVATE OpenSSL::SSL OpenSSL::Crypto CURL::libcurl SDL2::SDL2 ${OPENGL_LIBRARIES} discord-rpc ${GSTREAMER_LIBRARIES} ${AVFORMAT_LIBRARIES} ${AVUTIL_LIBRARIES})
|
||||
|
||||
@@ -68,6 +68,7 @@ int configHandler_Read(configHandler_config_t** configObj) {
|
||||
(*configObj)->lv2_parax32_frequency_left = NULL;
|
||||
(*configObj)->lv2_parax32_frequency_right = NULL;
|
||||
(*configObj)->lv2_reverb_filter_name = NULL;
|
||||
(*configObj)->local_rootdir = NULL;
|
||||
|
||||
// Set internal configuration values
|
||||
(*configObj)->internal_opensubsonic_version = strdup("1.8.0");
|
||||
@@ -465,6 +466,19 @@ int configHandler_Read(configHandler_config_t** configObj) {
|
||||
(*configObj)->lv2_reverb_filter_name = strdup(calf_reverb_filter_name->valuestring);
|
||||
}
|
||||
|
||||
// Make an object from local
|
||||
cJSON* local_root = cJSON_GetObjectItemCaseSensitive(root, "local");
|
||||
if (local_root == NULL) {
|
||||
logger_log_error(__func__, "Error parsing JSON - local does not exist.");
|
||||
cJSON_Delete(root);
|
||||
return 1;
|
||||
}
|
||||
|
||||
cJSON* local_root_directory = cJSON_GetObjectItemCaseSensitive(local_root, "rootDirectory");
|
||||
if (cJSON_IsString(local_root_directory) && local_root_directory->valuestring != NULL) {
|
||||
(*configObj)->local_rootdir = strdup(local_root_directory->valuestring);
|
||||
}
|
||||
|
||||
cJSON_Delete(root);
|
||||
logger_log_general(__func__, "Successfully read configuration file.");
|
||||
return 0;
|
||||
@@ -497,5 +511,6 @@ void configHandler_Free(configHandler_config_t** configObj) {
|
||||
if ((*configObj)->lv2_parax32_frequency_left != NULL) { free((*configObj)->lv2_parax32_frequency_left); }
|
||||
if ((*configObj)->lv2_parax32_frequency_right != NULL) { free((*configObj)->lv2_parax32_frequency_right); }
|
||||
if ((*configObj)->lv2_reverb_filter_name != NULL) { free((*configObj)->lv2_reverb_filter_name); }
|
||||
if ((*configObj)->local_rootdir != NULL) { free((*configObj)->local_rootdir); }
|
||||
if (*configObj != NULL) { free(*configObj); }
|
||||
}
|
||||
|
||||
@@ -65,6 +65,9 @@ typedef struct {
|
||||
char* lv2_parax32_frequency_left;
|
||||
char* lv2_parax32_frequency_right;
|
||||
char* lv2_reverb_filter_name; // LV2 Calf Reverb LV2 Name
|
||||
|
||||
// Local Settings
|
||||
char* local_rootdir; // Local Music Directory Root
|
||||
} configHandler_config_t;
|
||||
|
||||
int configHandler_Read(configHandler_config_t** config);
|
||||
|
||||
24
src/localMusicHandler.cpp
Normal file
24
src/localMusicHandler.cpp
Normal file
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
* OpenSubsonicPlayer
|
||||
* Goldenkrew3000 2025
|
||||
* License: GNU General Public License 3.0
|
||||
* Info: Local Music File Handler
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdint.h>
|
||||
#include <dirent.h>
|
||||
#include <errno.h>
|
||||
#include <sys/stat.h>
|
||||
#include "localMusicHandler.hpp"
|
||||
extern "C" {
|
||||
#include <libavformat/avformat.h>
|
||||
#include <libavutil/dict.h>
|
||||
#include <libavformat/avio.h>
|
||||
}
|
||||
|
||||
void localMusicHandler_scan() {
|
||||
//
|
||||
}
|
||||
20
src/localMusicHandler.hpp
Normal file
20
src/localMusicHandler.hpp
Normal file
@@ -0,0 +1,20 @@
|
||||
/*
|
||||
* OpenSubsonicPlayer
|
||||
* Goldenkrew3000 2025
|
||||
* License: GNU General Public License 3.0
|
||||
*/
|
||||
|
||||
#ifndef _LOCALMUSICHANDLER_H
|
||||
#define _LOCALMUSICHANDLER_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif // __cplusplus
|
||||
|
||||
//
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif // _LOCALMUSICHANDLER_H
|
||||
Reference in New Issue
Block a user