-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'video_decoder' into wip
- Loading branch information
Showing
54 changed files
with
6,201 additions
and
487 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
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,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}) |
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,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; | ||
} |
29 changes: 29 additions & 0 deletions
29
apps/examples/video_player_example/resources/shaders/glsl/texture_ycbcr.frag
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,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 ); | ||
} |
38 changes: 38 additions & 0 deletions
38
apps/examples/video_player_example/resources/shaders/glsl/texture_ycbcr.vert
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,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.
34 changes: 34 additions & 0 deletions
34
apps/examples/video_player_example/video_player_example_app/CMakeLists.txt
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,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}) |
Oops, something went wrong.