Add libmpv and create some functions to test that the linking works

This commit is contained in:
Ylva Selling
2022-12-12 15:07:24 -05:00
parent a132d5f48b
commit 33c4180e96
3 changed files with 31 additions and 0 deletions
+9
View File
@@ -150,6 +150,15 @@ target_precompile_headers(${globebrowsing_module} PRIVATE
# Ffmpeg
if(WIN32)
add_library(libmpv SHARED IMPORTED)
set_target_properties(libmpv PROPERTIES
IMPORTED_LOCATION "${CMAKE_CURRENT_SOURCE_DIR}/ext/libmpv/lib/mpv-2.dll"
IMPORTED_IMPLIB "${CMAKE_CURRENT_SOURCE_DIR}/ext/libmpv/lib/mpv.lib"
INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR}/ext/libmpv/include"
)
target_link_libraries(openspace-module-globebrowsing PUBLIC libmpv)
add_library(avcodec SHARED IMPORTED)
set_target_properties(avcodec PROPERTIES
IMPORTED_LOCATION "${CMAKE_CURRENT_SOURCE_DIR}/ext/ffmpeg/lib/avcodec-59.dll"
@@ -599,6 +599,16 @@ void FfmpegTileProvider::internalInitialize() {
// Create PBO for async texture upload
glGenBuffers(1, &_pbo);
// libmpv
mpvHandle = mpv_create();
if (!mpvHandle)
LINFO("mpv context init failed");
// Some minor options can only be set before mpv_initialize().
if (mpv_initialize(mpvHandle) < 0)
LINFO("mpv init failed");
_isInitialized = true;
}
@@ -29,6 +29,10 @@
#include <ghoul/glm.h>
// libmpv
#include <client.h>
#include <render_gl.h>
// FFMPEG
extern "C" {
#include <libavcodec/avcodec.h>
@@ -96,6 +100,14 @@ private:
GLubyte* _tilePixels = nullptr;
GLuint _pbo = 0;
// libmpv
mpv_handle* mpvHandle;
mpv_render_context* mpvRenderContext;
unsigned int mpvFBO = 0;
unsigned int mpvTex = 0;
int mpvVideoReconfigs = 0;
void internalInitialize() override final;
void internalDeinitialize() override final;
};