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