unfinished mac os backend implementation
This commit is contained in:
parent
6080802063
commit
06514cc4a0
|
@ -1,8 +1,11 @@
|
|||
cmake_minimum_required (VERSION 3.8)
|
||||
include("cmake/create_resources.cmake")
|
||||
|
||||
file(GLOB_RECURSE SOURCES "src/*.cpp")
|
||||
|
||||
#enable objective c support on mac os, needed for wxwidgets and compile for both intel macs and apple sillicon macs
|
||||
if(APPLE)
|
||||
list(APPEND SOURCES "src/backends/darwin.mm")
|
||||
set(CMAKE_OSX_ARCHITECTURES "arm64;x86_64" CACHE STRING "" FORCE)
|
||||
project ("PlayerLink" LANGUAGES C CXX OBJCXX)
|
||||
else()
|
||||
|
@ -10,7 +13,7 @@ else()
|
|||
endif()
|
||||
|
||||
create_resources("rsrc" "src/rsrc.hpp")
|
||||
file(GLOB_RECURSE SOURCES "src/*.cpp")
|
||||
|
||||
add_executable (PlayerLink ${SOURCES})
|
||||
set_property(TARGET PlayerLink PROPERTY CXX_STANDARD 20)
|
||||
add_subdirectory("vendor")
|
||||
|
@ -20,6 +23,15 @@ set(LIBRARIES discord-rpc libcurl_static mbedcrypto mbedx509 mbedtls wxmono)
|
|||
if(WIN32)
|
||||
list(APPEND LIBRARIES WindowsApp)
|
||||
target_link_options(PlayerLink PRIVATE "/SUBSYSTEM:WINDOWS" "/ENTRY:mainCRTStartup")
|
||||
elseif(APPLE)
|
||||
set(MEDIAREMOTE_FRAMEWORK_PATH "/System/Library/PrivateFrameworks")
|
||||
find_library(MEDIAREMOTE_LIBRARY MediaRemote PATHS ${MEDIAREMOTE_FRAMEWORK_PATH})
|
||||
if (MEDIAREMOTE_LIBRARY)
|
||||
message(STATUS "Found MediaRemote: ${MEDIAREMOTE_LIBRARY}")
|
||||
list(APPEND LIBRARIES ${MEDIAREMOTE_LIBRARY})
|
||||
else()
|
||||
message(FATAL_ERROR "MediaRemote framework not found.")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
#search directories for the autogenerated wxwidgets setup.h file for all plattforms
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
//
|
||||
// MediaRemote.h
|
||||
// MusicRPC
|
||||
//
|
||||
// Created by Alexandra Aurora Göttlicher
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
FOUNDATION_EXPORT CFStringRef _Nullable kMRMediaRemoteNowPlayingInfoDidChangeNotification;
|
||||
|
||||
FOUNDATION_EXPORT CFStringRef _Nullable kMRMediaRemoteNowPlayingInfoTitle;
|
||||
FOUNDATION_EXPORT CFStringRef _Nullable kMRMediaRemoteNowPlayingInfoAlbum;
|
||||
FOUNDATION_EXPORT CFStringRef _Nullable kMRMediaRemoteNowPlayingInfoArtist;
|
||||
FOUNDATION_EXPORT CFStringRef _Nullable kMRMediaRemoteNowPlayingInfoDuration;
|
||||
FOUNDATION_EXPORT CFStringRef _Nullable kMRMediaRemoteNowPlayingInfoElapsedTime;
|
||||
|
||||
typedef void (^ MRMediaRemoteGetNowPlayingInfoCompletion)(CFDictionaryRef _Nullable information);
|
||||
typedef void (^ MRMediaRemoteGetNowPlayingApplicationPIDCompletion)(int PID);
|
||||
typedef void (^ MRMediaRemoteGetNowPlayingApplicationIsPlayingCompletion)(Boolean isPlaying);
|
||||
|
||||
FOUNDATION_EXPORT void MRMediaRemoteRegisterForNowPlayingNotifications(dispatch_queue_t _Nullable queue);
|
||||
FOUNDATION_EXPORT void MRMediaRemoteGetNowPlayingApplicationPID(dispatch_queue_t _Nullable queue, MRMediaRemoteGetNowPlayingApplicationPIDCompletion _Nullable completion);
|
||||
FOUNDATION_EXPORT void MRMediaRemoteGetNowPlayingInfo(dispatch_queue_t _Nullable queue, MRMediaRemoteGetNowPlayingInfoCompletion _Nullable completion);
|
||||
FOUNDATION_EXPORT void MRMediaRemoteGetNowPlayingApplicationIsPlaying(dispatch_queue_t _Nullable queue, MRMediaRemoteGetNowPlayingApplicationIsPlayingCompletion _Nullable completion);
|
|
@ -1,5 +0,0 @@
|
|||
#ifdef __APPLE__
|
||||
#include "../backend.hpp"
|
||||
std::shared_ptr<MediaInfo> backend::getMediaInformation() { return nullptr; }
|
||||
bool backend::toggleAutostart(bool enabled) { return false, }
|
||||
#endif
|
|
@ -0,0 +1,16 @@
|
|||
#ifdef __APPLE__
|
||||
#include <Foundation/Foundation.h>
|
||||
#include "../MediaRemote.hpp"
|
||||
#include "../backend.hpp"
|
||||
|
||||
std::shared_ptr<MediaInfo> backend::getMediaInformation() {
|
||||
MRMediaRemoteGetNowPlayingInfo(dispatch_get_main_queue(), ^(CFDictionaryRef result) {
|
||||
if (result) {
|
||||
NSDictionary *playingInfo = (__bridge NSDictionary *)(result);
|
||||
NSLog(@"Now Playing Info: %@", playingInfo);
|
||||
}
|
||||
});
|
||||
return nullptr;
|
||||
}
|
||||
bool backend::toggleAutostart(bool enabled) { return false; }
|
||||
#endif
|
|
@ -1,5 +1,5 @@
|
|||
#if !defined(_WIN32) && !defined(__APPLE__)
|
||||
#include "../backend.hpp"
|
||||
std::shared_ptr<MediaInfo> backend::getMediaInformation() { return nullptr; }
|
||||
bool backend::toggleAutostart(bool enabled) { return false, }
|
||||
bool backend::toggleAutostart(bool enabled) { return false; }
|
||||
#endif
|
|
@ -4,6 +4,8 @@ SET(ENABLE_TESTING OFF FORCE)
|
|||
add_subdirectory("mbedtls")
|
||||
SET(CURL_USE_MBEDTLS ON)
|
||||
SET(CURL_USE_LIBPSL OFF)
|
||||
SET(CURL_USE_LIBSSH2 OFF)
|
||||
SET(USE_NGHTTP2 OFF)
|
||||
SET(USE_LIBIDN2 OFF)
|
||||
SET(BUILD_STATIC_LIBS ON)
|
||||
SET(BUILD_SHARED_LIBS OFF)
|
||||
|
|
Loading…
Reference in New Issue