mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-02 20:42:30 +00:00
matroska-mux: Handle multiview-mode/flags caps fields correctly when checking caps equality
Not having these fields is equivalent with them being mono/0 so consider them like that. The generic caps functions are not aware of these semantics and would consider the caps different, causing a negotiation failure when caps are changing from caps with to caps without or the other way around. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1833>
This commit is contained in:
parent
655a8e69e3
commit
bae270dd26
1 changed files with 29 additions and 10 deletions
|
@ -1008,13 +1008,32 @@ check_field (GQuark field_id, const GValue * value, gpointer user_data)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
else if (field_id == g_quark_from_static_string ("bit-depth-luma"))
|
else if (field_id == g_quark_from_static_string ("bit-depth-luma"))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
/* Remove multiview-mode=mono and multiview-flags=0 fields as those are
|
||||||
|
* equivalent with not having the fields but are not considered equivalent
|
||||||
|
* by the generic caps functions.
|
||||||
|
*/
|
||||||
|
if (field_id == g_quark_from_static_string ("multiview-mode")) {
|
||||||
|
const gchar *s = g_value_get_string (value);
|
||||||
|
|
||||||
|
if (g_strcmp0 (s, "mono") == 0)
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (field_id == g_quark_from_static_string ("multiview-flags")) {
|
||||||
|
guint multiview_flags = gst_value_get_flagset_flags (value);
|
||||||
|
|
||||||
|
if (multiview_flags == 0)
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
check_new_caps (GstCaps * old_caps, GstCaps * new_caps)
|
check_new_caps (GstMatroskaTrackVideoContext * videocontext, GstCaps * old_caps,
|
||||||
|
GstCaps * new_caps)
|
||||||
{
|
{
|
||||||
GstStructure *old_s, *new_s;
|
GstStructure *old_s, *new_s;
|
||||||
gboolean ret;
|
gboolean ret;
|
||||||
|
@ -1066,9 +1085,17 @@ gst_matroska_mux_video_pad_setcaps (GstPad * pad, GstCaps * caps)
|
||||||
|
|
||||||
mux = GST_MATROSKA_MUX (GST_PAD_PARENT (pad));
|
mux = GST_MATROSKA_MUX (GST_PAD_PARENT (pad));
|
||||||
|
|
||||||
|
/* find context */
|
||||||
|
collect_pad = (GstMatroskaPad *) gst_pad_get_element_private (pad);
|
||||||
|
g_assert (collect_pad);
|
||||||
|
context = collect_pad->track;
|
||||||
|
g_assert (context);
|
||||||
|
g_assert (context->type == GST_MATROSKA_TRACK_TYPE_VIDEO);
|
||||||
|
videocontext = (GstMatroskaTrackVideoContext *) context;
|
||||||
|
|
||||||
if ((old_caps = gst_pad_get_current_caps (pad))) {
|
if ((old_caps = gst_pad_get_current_caps (pad))) {
|
||||||
if (mux->state >= GST_MATROSKA_MUX_STATE_HEADER
|
if (mux->state >= GST_MATROSKA_MUX_STATE_HEADER
|
||||||
&& !check_new_caps (old_caps, caps)) {
|
&& !check_new_caps (videocontext, old_caps, caps)) {
|
||||||
GST_ELEMENT_ERROR (mux, STREAM, MUX, (NULL),
|
GST_ELEMENT_ERROR (mux, STREAM, MUX, (NULL),
|
||||||
("Caps changes are not supported by Matroska\nCurrent: `%"
|
("Caps changes are not supported by Matroska\nCurrent: `%"
|
||||||
GST_PTR_FORMAT "`\nNew: `%" GST_PTR_FORMAT "`", old_caps, caps));
|
GST_PTR_FORMAT "`\nNew: `%" GST_PTR_FORMAT "`", old_caps, caps));
|
||||||
|
@ -1083,14 +1110,6 @@ gst_matroska_mux_video_pad_setcaps (GstPad * pad, GstCaps * caps)
|
||||||
goto refuse_caps;
|
goto refuse_caps;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* find context */
|
|
||||||
collect_pad = (GstMatroskaPad *) gst_pad_get_element_private (pad);
|
|
||||||
g_assert (collect_pad);
|
|
||||||
context = collect_pad->track;
|
|
||||||
g_assert (context);
|
|
||||||
g_assert (context->type == GST_MATROSKA_TRACK_TYPE_VIDEO);
|
|
||||||
videocontext = (GstMatroskaTrackVideoContext *) context;
|
|
||||||
|
|
||||||
/* gst -> matroska ID'ing */
|
/* gst -> matroska ID'ing */
|
||||||
structure = gst_caps_get_structure (caps, 0);
|
structure = gst_caps_get_structure (caps, 0);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue