diff options
author | Sebastian Dröge <sebastian@centricular.com> | 2022-02-08 13:18:48 +0300 |
---|---|---|
committer | Sebastian Dröge <sebastian@centricular.com> | 2022-02-08 13:18:48 +0300 |
commit | 93bfa4d37abbbd7f01e01fb8088e2b6f19e5ec47 (patch) | |
tree | f12efc0460a58c6eea7447287ec11033654f4d91 /video/rav1e/src/rav1enc/imp.rs | |
parent | 22ae31bfcb646e6e93c1c8c6407cac52a41d60bd (diff) |
rav1enc: Put container sequence header into the caps
Diffstat (limited to 'video/rav1e/src/rav1enc/imp.rs')
-rw-r--r-- | video/rav1e/src/rav1enc/imp.rs | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/video/rav1e/src/rav1enc/imp.rs b/video/rav1e/src/rav1enc/imp.rs index ca7e5b75..7c832ce1 100644 --- a/video/rav1e/src/rav1enc/imp.rs +++ b/video/rav1e/src/rav1enc/imp.rs @@ -93,6 +93,13 @@ enum Context { } impl Context { + fn container_sequence_header(&self) -> Vec<u8> { + match self { + Context::Eight(ref context) => context.container_sequence_header(), + Context::Sixteen(ref context) => context.container_sequence_header(), + } + } + fn receive_packet( &mut self, ) -> Result<(data::FrameType, u64, u32, Vec<u8>), data::EncoderStatus> { @@ -840,8 +847,8 @@ impl VideoEncoderImpl for Rav1Enc { .with_threads(settings.threads); // TODO: RateControlConfig - *self.state.lock().unwrap() = Some(State { - context: if video_info.format_info().depth()[0] > 8 { + let context = + if video_info.format_info().depth()[0] > 8 { Context::Sixteen(cfg.new_context().map_err(|err| { gst::loggable_error!(CAT, "Failed to create context: {:?}", err) })?) @@ -849,7 +856,12 @@ impl VideoEncoderImpl for Rav1Enc { Context::Eight(cfg.new_context().map_err(|err| { gst::loggable_error!(CAT, "Failed to create context: {:?}", err) })?) - }, + }; + let container_sequence_header = + gst::Buffer::from_mut_slice(context.container_sequence_header()); + + *self.state.lock().unwrap() = Some(State { + context, video_info, }); @@ -858,6 +870,7 @@ impl VideoEncoderImpl for Rav1Enc { gst::Caps::builder("video/x-av1") .field("stream-format", "obu-stream") .field("alignment", "tu") + .field("codec_data", container_sequence_header) .build(), Some(state), ) |