Skip to content

Commit

Permalink
Add support for VkVideoSession
Browse files Browse the repository at this point in the history
  • Loading branch information
dwlsalmeida committed Oct 25, 2023
1 parent a493758 commit 7a36c67
Show file tree
Hide file tree
Showing 3 changed files with 386 additions and 3 deletions.
22 changes: 20 additions & 2 deletions examples/src/bin/video.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ use std::sync::Arc;
use vulkano::{
device::{Device, DeviceCreateInfo, DeviceExtensions, QueueCreateInfo, QueueFlags},
image::ImageUsage,
instance::{Instance, InstanceCreateFlags, InstanceCreateInfo, InstanceExtensions},
instance::{Instance, InstanceCreateFlags, InstanceCreateInfo},
video::{
CodecCapabilities, VideoDecodeCapabilityFlags, VideoDecodeH264PictureLayoutFlags,
VideoDecodeH264ProfileInfo, VideoFormatInfo, VideoProfileInfo, VideoProfileListInfo,
VideoSession, VideoSessionCreateInfo,
},
VulkanLibrary,
};
Expand Down Expand Up @@ -152,9 +153,26 @@ fn main() {
},
};

let formats = physical_device
let mut formats = physical_device
.video_format_properties(video_format_info)
.unwrap();

println!("video formats: {:#?}", formats);

let format = formats.pop().unwrap();

let video_session_create_info = VideoSessionCreateInfo {
queue_family_index: video_queue_family_index,
video_profile: profile_info,
picture_format: format.format,
max_coded_extent: video_caps.max_coded_extent,
reference_picture_format: format.format,
max_dpb_slots: video_caps.max_dpb_slots,
max_active_reference_pictures: video_caps.max_active_reference_pictures,
std_header_version: video_caps.std_header_version,
..Default::default()
};

let video_session = VideoSession::new(Arc::clone(&device), video_session_create_info).unwrap();
println!("video session: {:#?}", video_session);
}
1 change: 1 addition & 0 deletions vulkano/src/device/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ use crate::{
instance::{Instance, InstanceOwned, InstanceOwnedDebugWrapper},
macros::{impl_id_counter, vulkan_bitflags},
memory::ExternalMemoryHandleType,
video::{VideoSession, VideoSessionCreateInfo},
Requires, RequiresAllOf, RequiresOneOf, Validated, ValidationError, Version, VulkanError,
VulkanObject,
};
Expand Down
Loading

0 comments on commit 7a36c67

Please sign in to comment.