Skip to content

Commit

Permalink
merge with video decoder branch
Browse files Browse the repository at this point in the history
Merge branch 'video_decoder' into wip
  • Loading branch information
tgfrerer committed Dec 14, 2023
2 parents e4b1e21 + e2f167e commit 40d0a14
Show file tree
Hide file tree
Showing 54 changed files with 6,201 additions and 487 deletions.
4 changes: 4 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,7 @@
[submodule "modules/le_tracy/3rdparty/tracy"]
path = modules/le_tracy/3rdparty/tracy
url = https://github.com/wolfpld/tracy.git
[submodule "modules/le_video_decoder/3rdparty/minimp4"]
path = modules/le_video_decoder/3rdparty/minimp4
url = https://github.com/lieff/minimp4

13 changes: 3 additions & 10 deletions apps/examples/asterisks/asterisks_app/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,17 @@ set (SOURCES "asterisks_app.cpp")
set (SOURCES ${SOURCES} "asterisks_app.h")

if (${PLUGINS_DYNAMIC})

add_library(${TARGET} SHARED ${SOURCES})


add_dynamic_linker_flags()

target_compile_definitions(${TARGET} PUBLIC "PLUGINS_DYNAMIC")

else()

# Adding a static library means to also add a linker dependency for our target
# to the library.

# Adding a static library means to also add
# a linker dependency for our target to the library.
add_static_lib(${TARGET})
add_library(${TARGET} STATIC ${SOURCES})

endif()

target_include_directories(${TARGET} PUBLIC ${MODULE_LOCATIONS_LIST})
target_link_libraries(${TARGET} PUBLIC ${LINKER_FLAGS})

source_group(${TARGET} FILES ${SOURCES})
2 changes: 1 addition & 1 deletion apps/examples/hello_triangle/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ project(${PROJECT_NAME})
# (currently this will only work correctly under Linux) add_compile_definitions(
# LE_MT=4 )

# To enable tracing with Tracy, uncomment the following line
# To enable tracing with Tracy, uncomment the following line:
# add_compile_definitions( TRACY_ENABLE )

# Vulkan Validation layers are enabled by default for Debug builds. Uncomment
Expand Down
11 changes: 2 additions & 9 deletions apps/examples/hello_triangle/hello_triangle_app/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,14 @@ set (SOURCES "hello_triangle_app.cpp")
set (SOURCES ${SOURCES} "hello_triangle_app.h")

if (${PLUGINS_DYNAMIC})

add_library(${TARGET} SHARED ${SOURCES})

add_dynamic_linker_flags()

target_compile_definitions(${TARGET} PUBLIC "PLUGINS_DYNAMIC")

else()

# Adding a static library means to also add a linker dependency for our target
# to the library.
# Adding a static library means to also add
# a linker dependency for our target to the library.
add_static_lib(${TARGET})

add_library(${TARGET} STATIC ${SOURCES})

endif()

target_link_libraries(${TARGET} PUBLIC ${LINKER_FLAGS})
Expand Down
52 changes: 52 additions & 0 deletions apps/examples/video_player_example/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
cmake_minimum_required(VERSION 3.7.2)
set (CMAKE_CXX_STANDARD 20)

set (PROJECT_NAME "Island-VideoPlayerExample")

# Set global property (all targets are impacted)
# set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "${CMAKE_COMMAND} -E time")
# set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK "${CMAKE_COMMAND} -E time")

project (${PROJECT_NAME})

#if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
# add_compile_options("-ftime-trace")
#endif()

message(STATUS "Compiler id: '${CMAKE_CXX_COMPILER_ID}'" )

# set to number of worker threads if you wish to use multi-threaded rendering
# add_compile_definitions( LE_MT=4 )

# Video is a vulkan beta feature, we must enable beta extensions therefore
add_compile_definitions( VK_ENABLE_BETA_EXTENSIONS=true)

# Point this to the base directory of your Island installation
set (ISLAND_BASE_DIR "${PROJECT_SOURCE_DIR}/../../..")

# Select which standard Island modules to use
set(REQUIRES_ISLAND_LOADER ON )
set(REQUIRES_ISLAND_CORE ON )

# Loads Island framework, based on selected Island modules from above
include ("${ISLAND_BASE_DIR}/CMakeLists.txt.island_prolog.in")

# Add custom module search paths
# add_island_module_location("${ISLAND_BASE_DIR}/../modules")

# Main application c++ file. Not much to see there,
set (SOURCES main.cpp)

# Add application module, and (optionally) any other private
# island modules which should not be part of the shared framework.
add_subdirectory (video_player_example_app)

# Sets up Island framework linkage and housekeeping, based on user selections
include ("${ISLAND_BASE_DIR}/CMakeLists.txt.island_epilog.in")

# create a link to local resources
link_resources(${PROJECT_SOURCE_DIR}/resources ${CMAKE_BINARY_DIR}/local_resources)

set_target_properties(${PROJECT_NAME} PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY "${CMAKE_BINARY_DIR}")

source_group(${PROJECT_NAME} FILES ${SOURCES})
33 changes: 33 additions & 0 deletions apps/examples/video_player_example/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#include "video_player_example_app/video_player_example_app.h"

// ----------------------------------------------------------------------

int main( int argc, char const* argv[] ) {

VideoPlayerExampleApp::initialize();

{
// We instantiate VideoPlayerExampleApp in its own scope - so that
// it will be destroyed before VideoPlayerExampleApp::terminate
// is called.

VideoPlayerExampleApp VideoPlayerExampleApp{};

for ( ;; ) {

#ifdef PLUGINS_DYNAMIC
le_core_poll_for_module_reloads();
#endif
auto result = VideoPlayerExampleApp.update();

if ( !result ) {
break;
}
}
}

// Must only be called once last VideoPlayerExampleApp is destroyed
VideoPlayerExampleApp::terminate();

return 0;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#version 450 core

#extension GL_ARB_separate_shader_objects : enable
#extension GL_ARB_shading_language_420pack : enable

// inputs
layout (location = 0) in VertexData {
vec2 texCoord;
} inData;

// outputs
layout (location = 0) out vec4 outFragColor;

// Note the suffix to the sampler name: `__ycbcr__` - this signals to Island
// that the image is a yuv image, and that it must create an immutable color
// conversion sampler for this image.
//
layout (set = 1, binding = 0 ) uniform sampler2D tex_video__ycbcr__;

layout (set = 0, binding = 0) uniform Mvp
{
mat4 modelMatrix;
mat4 viewMatrix;
mat4 projectionMatrix;
};

void main(){
outFragColor = vec4( texture(tex_video__ycbcr__, inData.texCoord).rgb, 1 );
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#version 450 core

#extension GL_ARB_separate_shader_objects : enable
#extension GL_ARB_shading_language_420pack : enable

// inputs
layout (location = 0) in vec3 pos;
layout (location = 1) in vec2 tex_coord;

// outputs
layout (location = 0) out VertexData {
vec2 texCoord;
} outData;


// arguments
layout (set = 0, binding = 0) uniform Mvp {
mat4 modelMatrix;
mat4 viewMatrix;
mat4 projectionMatrix;
};

// We override the built-in fixed function outputs
// to have more control over the SPIR-V code created.
out gl_PerVertex {
vec4 gl_Position;
};



void main() {

outData.texCoord = tex_coord;

vec4 position = projectionMatrix * viewMatrix * modelMatrix * vec4(pos,1);

gl_Position = position;
}
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
set (TARGET video_player_example_app)

# Specify any used modules here - you may reference any module
# found in the default Island modules/ directory, or found in any
# directories you specified via `add_island_module_location` above.
#
depends_on_island_module(le_window)
depends_on_island_module(le_ui_event)
depends_on_island_module(le_renderer)
depends_on_island_module(le_pipeline_builder)
depends_on_island_module(le_camera)
depends_on_island_module(le_video_decoder)
depends_on_island_module(le_timebase)
depends_on_island_module(le_imgui)
depends_on_island_module(le_log)

set (SOURCES "video_player_example_app.cpp")
set (SOURCES ${SOURCES} "video_player_example_app.h")

if (${PLUGINS_DYNAMIC})
add_library(${TARGET} SHARED ${SOURCES})
add_dynamic_linker_flags()
target_compile_definitions(${TARGET} PUBLIC "PLUGINS_DYNAMIC")
else()
# Adding a static library means to also add a linker dependency for our target
# to the library.
add_static_lib(${TARGET})
add_library(${TARGET} STATIC ${SOURCES})
endif()

target_include_directories(${TARGET} PUBLIC ${MODULE_LOCATIONS_LIST})
target_link_libraries(${TARGET} PUBLIC ${LINKER_FLAGS})

source_group(${TARGET} FILES ${SOURCES})
Loading

0 comments on commit 40d0a14

Please sign in to comment.