cmafmux: Add send-headers signal

Forces cmafmux to output headers for the init segment again, alongside the next chunk.
Needed for hlscmafsink to support changing output paths on the fly, without going back to READY.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1692>
This commit is contained in:
Piotr Brzeziński 2024-08-02 17:33:22 +02:00 committed by GStreamer Marge Bot
parent ad0a23fee7
commit 798936afc9
2 changed files with 37 additions and 2 deletions

View file

@ -2111,7 +2111,15 @@
"presence": "always"
}
},
"rank": "primary"
"rank": "primary",
"signals": {
"send-headers": {
"action": true,
"args": [],
"return-type": "void",
"when": "last"
}
}
},
"dashmp4mux": {
"author": "Sebastian Dröge <sebastian@centricular.com>",

View file

@ -2398,6 +2398,7 @@ impl FMP4Mux {
fmp4_header = Some(buffer);
gst::debug!(CAT, imp = self, "Headers will be sent now");
state.sent_headers = true;
}
@ -3631,6 +3632,8 @@ impl FMP4MuxImpl for ISOFMP4Mux {
const VARIANT: super::Variant = super::Variant::ISO;
}
static CMAF_SIGNAL_SEND_HEADERS: &str = "send-headers";
#[derive(Default)]
pub(crate) struct CMAFMux;
@ -3641,7 +3644,31 @@ impl ObjectSubclass for CMAFMux {
type ParentType = super::FMP4Mux;
}
impl ObjectImpl for CMAFMux {}
impl ObjectImpl for CMAFMux {
fn signals() -> &'static [glib::subclass::Signal] {
static SIGNALS: Lazy<Vec<glib::subclass::Signal>> = Lazy::new(|| {
vec![glib::subclass::Signal::builder(CMAF_SIGNAL_SEND_HEADERS)
.action()
.class_handler(|_token, args| {
let element = args[0].get::<super::FMP4Mux>().expect("signal arg");
let imp = element.imp();
let mut state = imp.state.lock().unwrap();
state.sent_headers = false;
gst::debug!(
CAT,
obj = element,
"Init headers will be re-sent alongside the next chunk"
);
None
})
.build()]
});
SIGNALS.as_ref()
}
}
impl GstObjectImpl for CMAFMux {}