fmp4mux: Accept tag updates before stream starts

Tag updates should be done if either the tag is set before the stream
started or if tag changes are allowed while the stream is already
running.

Fixes #629

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1921>
This commit is contained in:
Jochen Henneberg 2024-11-18 10:43:08 +01:00 committed by GStreamer Marge Bot
parent 28e66e150f
commit 08c026cea6

View file

@ -3670,11 +3670,11 @@ impl AggregatorImpl for FMP4Mux {
let language_code = Some(language_code);
// If the language changed and we have buffers
// trigger caps change
if state.language_code != language_code
&& !state.streams.is_empty()
&& self.header_update_allowed("language code")
{
// trigger header update
if state.language_code != language_code {
if state.streams.is_empty() {
state.language_code = language_code;
} else if self.header_update_allowed("language code") {
state.language_code = language_code;
state.need_new_header = true;
@ -3687,6 +3687,7 @@ impl AggregatorImpl for FMP4Mux {
}
}
}
}
} else if let Some(tag_value) = ev.tag().get::<gst::tags::ImageOrientation>() {
let orientation = tag_value.get();
gst::trace!(
@ -3720,12 +3721,21 @@ impl AggregatorImpl for FMP4Mux {
// If the orientation changed and we have buffers
// trigger caps change
if state.orientation != orientation
&& !state.streams.is_empty()
&& self.header_update_allowed("orientation")
{
if state.orientation != orientation {
if state.streams.is_empty() {
state.orientation = orientation;
} else if self.header_update_allowed("orientation") {
state.orientation = orientation;
state.need_new_header = true;
if let Some(stream) = state
.streams
.iter_mut()
.find(|s| *aggregator_pad == s.sinkpad)
{
stream.tag_changed = true;
}
}
}
}