base: video-converter: add accessors for input and output formats
authorGuillaume Desmottes <guillaume.desmottes@onestream.live>
Wed, 17 Aug 2022 10:53:02 +0000 (12:53 +0200)
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Wed, 17 Aug 2022 12:33:54 +0000 (12:33 +0000)
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2905>

subprojects/gst-plugins-base/gst-libs/gst/video/video-converter.c
subprojects/gst-plugins-base/gst-libs/gst/video/video-converter.h
subprojects/gst-plugins-base/tests/check/libs/video.c

index 4ccabe1..5123466 100644 (file)
@@ -8264,3 +8264,35 @@ video_converter_lookup_fastpath (GstVideoConverter * convert)
   GST_DEBUG ("no fastpath found");
   return FALSE;
 }
+
+/**
+ * gst_video_converter_get_in_info:
+ * @in_info: a #GstVideoConverter
+ *
+ * Retrieve the input format of @convert.
+ *
+ * Returns: (transfer none): a #GstVideoInfo
+ *
+ * Since: 1.22
+ */
+const GstVideoInfo *
+gst_video_converter_get_in_info (GstVideoConverter * convert)
+{
+  return &convert->in_info;
+}
+
+/**
+ * gst_video_converter_get_out_info:
+ * @in_info: a #GstVideoConverter
+ *
+ * Retrieve the output format of @convert.
+ *
+ * Returns: (transfer none): a #GstVideoInfo
+ *
+ * Since: 1.22
+ */
+const GstVideoInfo *
+gst_video_converter_get_out_info (GstVideoConverter * convert)
+{
+  return &convert->out_info;
+}
index 7175f42..f064d2e 100644 (file)
@@ -313,6 +313,12 @@ void                 gst_video_converter_frame          (GstVideoConverter * con
 GST_VIDEO_API
 void                 gst_video_converter_frame_finish   (GstVideoConverter * convert);
 
+GST_VIDEO_API
+const GstVideoInfo * gst_video_converter_get_in_info    (GstVideoConverter * convert);
+
+GST_VIDEO_API
+const GstVideoInfo * gst_video_converter_get_out_info   (GstVideoConverter * convert);
+
 G_END_DECLS
 
 #endif /* __GST_VIDEO_CONVERTER_H__ */
index 5792364..875f322 100644 (file)
@@ -2739,6 +2739,11 @@ GST_START_TEST (test_video_convert)
           GST_VIDEO_CONVERTER_OPT_DEST_WIDTH, G_TYPE_INT, 300,
           GST_VIDEO_CONVERTER_OPT_DEST_HEIGHT, G_TYPE_INT, 220, NULL));
 
+  g_assert (gst_video_info_is_equal (&ininfo,
+          gst_video_converter_get_in_info (convert)));
+  g_assert (gst_video_info_is_equal (&outinfo,
+          gst_video_converter_get_out_info (convert)));
+
   gst_video_converter_frame (convert, &inframe, &outframe);
   gst_video_converter_free (convert);