summaryrefslogtreecommitdiff
path: root/ext/closedcaption
diff options
context:
space:
mode:
authorMatthew Waters <matthew@centricular.com>2020-07-01 20:28:01 +1000
committerGStreamer Merge Bot <gitlab-merge-bot@gstreamer-foundation.org>2020-07-01 19:33:56 +0000
commitc6c4d42c4ae315f4650dee1c4262c23a38c6fb72 (patch)
tree0d70a0cb5176e7bf79ebce8cbfe88680be5cde1e /ext/closedcaption
parent4f334234c82cc8924eab4b8bdd7fc7593c97dc85 (diff)
downloadgstreamer-plugins-bad-c6c4d42c4ae315f4650dee1c4262c23a38c6fb72.tar.gz
ccconverter: fail negotiation when framerate conversion is not possible
Converting between anything but cdp will fail at converting framerates and negotiation should reflect that. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1393>
Diffstat (limited to 'ext/closedcaption')
-rw-r--r--ext/closedcaption/gstccconverter.c33
1 files changed, 30 insertions, 3 deletions
diff --git a/ext/closedcaption/gstccconverter.c b/ext/closedcaption/gstccconverter.c
index 8d2313014..56591c0a9 100644
--- a/ext/closedcaption/gstccconverter.c
+++ b/ext/closedcaption/gstccconverter.c
@@ -111,7 +111,16 @@ gst_cc_converter_transform_caps (GstBaseTransform * base,
* We can convert everything to CEA608.
*/
res = gst_caps_merge (res, gst_static_caps_get (&cdp_caps_framerate));
- res = gst_caps_merge (res, gst_static_caps_get (&non_cdp_caps));
+ if (framerate) {
+ /* we can only keep the same framerate for non-cdp */
+ GstCaps *tmp;
+
+ tmp = gst_caps_make_writable (gst_static_caps_get (&non_cdp_caps));
+ gst_caps_set_value (tmp, "framerate", framerate);
+ res = gst_caps_merge (res, tmp);
+ } else {
+ res = gst_caps_merge (res, gst_static_caps_get (&non_cdp_caps));
+ }
} else {
/* SINK: We produce downstream caps
*
@@ -211,7 +220,16 @@ gst_cc_converter_transform_caps (GstBaseTransform * base,
} else {
/* Downstream wants not only CDP, we can do everything */
res = gst_caps_merge (res, gst_static_caps_get (&cdp_caps_framerate));
- res = gst_caps_merge (res, gst_static_caps_get (&non_cdp_caps));
+ if (framerate) {
+ /* we can only keep the same framerate for non-cdp */
+ GstCaps *tmp;
+
+ tmp = gst_caps_make_writable (gst_static_caps_get (&non_cdp_caps));
+ gst_caps_set_value (tmp, "framerate", framerate);
+ res = gst_caps_merge (res, tmp);
+ } else {
+ res = gst_caps_merge (res, gst_static_caps_get (&non_cdp_caps));
+ }
}
} else {
GstCaps *tmp;
@@ -254,7 +272,16 @@ gst_cc_converter_transform_caps (GstBaseTransform * base,
res = gst_caps_merge (res, tmp);
}
/* We can always convert CEA708 to all non-CDP formats */
- res = gst_caps_merge (res, gst_static_caps_get (&non_cdp_caps));
+ if (framerate) {
+ /* we can only keep the same framerate for non-cdp */
+ GstCaps *tmp;
+
+ tmp = gst_caps_make_writable (gst_static_caps_get (&non_cdp_caps));
+ gst_caps_set_value (tmp, "framerate", framerate);
+ res = gst_caps_merge (res, tmp);
+ } else {
+ res = gst_caps_merge (res, gst_static_caps_get (&non_cdp_caps));
+ }
}
} else {
g_assert_not_reached ();