forked from alexmercerind/dart_vlc
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add common library (alexmercerind#110)
Build a common library that gets linked into the platform-specific plugin shared library.
- Loading branch information
Showing
67 changed files
with
1,817 additions
and
247 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,4 +10,3 @@ build/ | |
|
||
.idea | ||
|
||
example/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
cmake_minimum_required(VERSION 3.13) | ||
set(CMAKE_CXX_STANDARD 17) | ||
|
||
if(UNIX AND NOT APPLE) | ||
set(LINUX TRUE) | ||
endif() | ||
|
||
set(LIBRARY_NAME dart_vlc_core) | ||
project(${LIBRARY_NAME} LANGUAGES C CXX) | ||
|
||
set(LIBVLC_VERSION "3.0.9.2") | ||
set(LIBVLC_BINARIES "${CMAKE_CURRENT_SOURCE_DIR}/../bin") | ||
|
||
set(LIBVLC_ARCHIVE "${LIBVLC_BINARIES}/vlc-${LIBVLC_VERSION}.7z") | ||
set(LIBVLCPP_ARCHIVE "${LIBVLC_BINARIES}/libvlcpp.zip") | ||
|
||
set(LIBVLC_PACKAGE_DIR "${CMAKE_BINARY_DIR}/${LIBRARY_NAME}_packages") | ||
set(LIBVLC_SOURCE "${LIBVLC_PACKAGE_DIR}/vlc-${LIBVLC_VERSION}") | ||
set(LIBVLCPP_SOURCE "${LIBVLC_PACKAGE_DIR}/libvlcpp-master") | ||
|
||
add_custom_target(LIBVLC_EXTRACT ALL) | ||
|
||
if (NOT EXISTS "${LIBVLC_SOURCE}" OR NOT EXISTS "${LIBVLCPP_SOURCE}") | ||
file(MAKE_DIRECTORY ${LIBVLC_PACKAGE_DIR}) | ||
add_custom_command( | ||
TARGET LIBVLC_EXTRACT PRE_BUILD | ||
COMMAND ${CMAKE_COMMAND} -E tar xzf \"${LIBVLC_ARCHIVE}\" | ||
COMMAND ${CMAKE_COMMAND} -E tar xzf \"${LIBVLCPP_ARCHIVE}\" | ||
WORKING_DIRECTORY "${LIBVLC_PACKAGE_DIR}" | ||
DEPENDS "${LIBVLC_ARCHIVE}" "${LIBVLCPP_ARCHIVE}" | ||
) | ||
endif() | ||
|
||
add_library(${LIBRARY_NAME} STATIC | ||
main.cc | ||
api/api.cc | ||
) | ||
add_dependencies(${LIBRARY_NAME} LIBVLC_EXTRACT) | ||
|
||
set_target_properties(${LIBRARY_NAME} PROPERTIES LINKER_LANGUAGE CXX) | ||
|
||
get_directory_property(hasParent PARENT_DIRECTORY) | ||
|
||
target_include_directories(${LIBRARY_NAME} PRIVATE | ||
# dart_vlc wrapper headers. | ||
"${CMAKE_CURRENT_SOURCE_DIR}" | ||
# libVLC++ headers. | ||
"${LIBVLCPP_SOURCE}" | ||
# libVLC headers. | ||
"${LIBVLC_SOURCE}/sdk/include" | ||
) | ||
|
||
target_include_directories(${LIBRARY_NAME} INTERFACE | ||
# libVLC++ headers. | ||
"${LIBVLCPP_SOURCE}" | ||
# libVLC headers. | ||
"${LIBVLC_SOURCE}/sdk/include" | ||
) | ||
|
||
if(WIN32) | ||
set_target_properties(${LIBRARY_NAME} PROPERTIES CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) | ||
target_link_libraries(${LIBRARY_NAME} PRIVATE | ||
"${LIBVLC_SOURCE}/sdk/lib/libvlc.lib" | ||
"${LIBVLC_SOURCE}/sdk/lib/libvlccore.lib" | ||
) | ||
|
||
# Add generated shared library & libVLC DLLs. | ||
set(DARTVLC_CORE_LIBS | ||
# In case we decide to build this as a shared library | ||
#"$<TARGET_FILE:dart_vlc_core>" | ||
|
||
"${LIBVLC_SOURCE}/libvlc.dll" | ||
"${LIBVLC_SOURCE}/libvlccore.dll" | ||
"${LIBVLC_SOURCE}/plugins" | ||
PARENT_SCOPE | ||
) | ||
|
||
elseif(LINUX) | ||
set_target_properties(${LIBRARY_NAME} PROPERTIES POSITION_INDEPENDENT_CODE ON) | ||
target_link_libraries(${LIBRARY_NAME} PRIVATE | ||
"vlc" | ||
) | ||
endif() | ||
|
||
if (hasParent) | ||
set(DARTVLC_CORE_PATH ${CMAKE_CURRENT_SOURCE_DIR} PARENT_SCOPE) | ||
else() | ||
# only required by our podspec script phase | ||
install(TARGETS ${LIBRARY_NAME}) | ||
endif() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
/* | ||
* dart_vlc: A media playback library for Dart & Flutter. Based on libVLC & | ||
* libVLC++. | ||
* | ||
* Hitesh Kumar Saini | ||
* https://github.com/alexmercerind | ||
* [email protected] | ||
* | ||
* GNU Lesser General Public License v2.1 | ||
*/ | ||
|
||
#ifndef API_DART_VLC_H_ | ||
#define API_DART_VLC_H_ | ||
|
||
#include <cstdint> | ||
|
||
#include "base.h" | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
DLLEXPORT void PlayerCreate(int32_t id, int32_t video_width, | ||
int32_t video_height, | ||
int32_t commandLineArgumentsCount, | ||
const char** commandLineArguments); | ||
DLLEXPORT void PlayerDispose(int32_t id); | ||
|
||
DLLEXPORT void PlayerOpen(int32_t id, bool auto_start, const char** source, | ||
int32_t source_size); | ||
|
||
DLLEXPORT void PlayerPlay(int32_t id); | ||
|
||
DLLEXPORT void PlayerPause(int32_t id); | ||
|
||
DLLEXPORT void PlayerPlayOrPause(int32_t id); | ||
|
||
DLLEXPORT void PlayerStop(int32_t id); | ||
DLLEXPORT void PlayerNext(int32_t id); | ||
|
||
DLLEXPORT void PlayerBack(int32_t id); | ||
|
||
DLLEXPORT void PlayerJump(int32_t id, int32_t index); | ||
|
||
DLLEXPORT void PlayerSeek(int32_t id, int32_t position); | ||
|
||
DLLEXPORT void PlayerSetVolume(int32_t id, float volume); | ||
|
||
DLLEXPORT void PlayerSetRate(int32_t id, float rate); | ||
|
||
DLLEXPORT void PlayerSetUserAgent(int32_t id, const char* userAgent); | ||
|
||
DLLEXPORT void PlayerSetDevice(int32_t id, const char* device_id, | ||
const char* device_name); | ||
|
||
DLLEXPORT void PlayerSetEqualizer(int32_t id, int32_t equalizer_id); | ||
|
||
DLLEXPORT void PlayerSetPlaylistMode(int32_t id, const char* mode); | ||
|
||
DLLEXPORT void PlayerAdd(int32_t id, const char* type, const char* resource); | ||
|
||
DLLEXPORT void PlayerRemove(int32_t id, int32_t index); | ||
|
||
DLLEXPORT void PlayerInsert(int32_t id, int32_t index, const char* type, | ||
const char* resource); | ||
|
||
DLLEXPORT void Player_move(int32_t id, int32_t initial_index, | ||
int32_t final_index); | ||
|
||
DLLEXPORT char** MediaParse(const char* type, const char* resource, | ||
int32_t timeout); | ||
|
||
DLLEXPORT void MediaClear(); | ||
|
||
DLLEXPORT void BroadcastCreate(int32_t id, const char* type, | ||
const char* resource, const char* access, | ||
const char* mux, const char* dst, | ||
const char* vcodec, int32_t vb, | ||
const char* acodec, int32_t ab); | ||
|
||
DLLEXPORT void BroadcastStart(int32_t id); | ||
|
||
DLLEXPORT void BroadcastDispose(int32_t id); | ||
|
||
DLLEXPORT void ChromecastCreate(int32_t id, const char* type, | ||
const char* resource, const char* ip_address); | ||
|
||
DLLEXPORT void ChromecastStart(int32_t id); | ||
|
||
DLLEXPORT void ChromecastDispose(int32_t id); | ||
DLLEXPORT void RecordCreate(int32_t id, const char* saving_file, | ||
const char* type, const char* resource); | ||
DLLEXPORT void RecordStart(int32_t id); | ||
DLLEXPORT void RecordDispose(int32_t id); | ||
DLLEXPORT char** DevicesAll(); | ||
DLLEXPORT void DevicesClear(); | ||
DLLEXPORT char** EqualizerCreateEmpty(); | ||
DLLEXPORT char** EqualizerCreateMode(int32_t mode); | ||
DLLEXPORT void EqualizerClear(); | ||
DLLEXPORT void EqualizerSetBandAmp(int32_t id, float band, float amp); | ||
DLLEXPORT void EqualizerSetPreAmp(int32_t id, float amp); | ||
|
||
#endif | ||
#ifdef __cplusplus | ||
} | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#ifndef BASE_H_ | ||
#define BASE_H_ | ||
|
||
#ifndef DLLEXPORT | ||
#ifdef _WIN32 | ||
#define DLLEXPORT __declspec(dllexport) | ||
#else | ||
#define DLLEXPORT | ||
#endif | ||
#endif | ||
|
||
#endif |
Oops, something went wrong.