summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2018-03-01 11:08:44 +0100
committerNicolas Dufresne <nicolas.dufresne@collabora.com>2018-03-05 13:19:42 -0500
commitd252f503fc2cd9e373e1467cdf3f0de34345359a (patch)
treeb630930b211f7ecb737e2bca3c70f913bd03a8b0 /tests
parent076809ebd582638c8198276325ede5b59eb9b102 (diff)
h265parser: decouple GstH265Profile and GstH265ProfileIDC
We used to have the same enum to represent H265 profiles and idc values. Those are no longer the same with extension profiles defined from version 2 of the spec. Split those enums so the semantic of each is clearer and we'll be able to add extension profiles to GstH265Profile. Also add gst_h265_profile_tier_level_get_profile() to retrieve the GstH265Profile from the GstH265ProfileTierLevel. It will be used to implement the detection of extension profiles. https://bugzilla.gnome.org/show_bug.cgi?id=793876
Diffstat (limited to 'tests')
-rw-r--r--tests/check/Makefile.am10
-rw-r--r--tests/check/libs/h265parser.c87
-rw-r--r--tests/check/meson.build1
3 files changed, 98 insertions, 0 deletions
diff --git a/tests/check/Makefile.am b/tests/check/Makefile.am
index dc2cac995..e23a05f1f 100644
--- a/tests/check/Makefile.am
+++ b/tests/check/Makefile.am
@@ -276,6 +276,7 @@ check_PROGRAMS = \
libs/mpegvideoparser \
libs/mpegts \
libs/h264parser \
+ libs/h265parser \
libs/vp8parser \
$(check_uvch264) \
libs/vc1parser \
@@ -361,6 +362,15 @@ libs_h264parser_LDADD = \
$(top_builddir)/gst-libs/gst/codecparsers/libgstcodecparsers-@GST_API_VERSION@.la \
$(GST_BASE_LIBS) $(GST_LIBS) $(LDADD)
+libs_h265parser_CFLAGS = \
+ $(GST_PLUGINS_BAD_CFLAGS) $(GST_PLUGINS_BASE_CFLAGS) \
+ -DGST_USE_UNSTABLE_API \
+ $(GST_BASE_CFLAGS) $(GST_CFLAGS) $(AM_CFLAGS)
+
+libs_h265parser_LDADD = \
+ $(top_builddir)/gst-libs/gst/codecparsers/libgstcodecparsers-@GST_API_VERSION@.la \
+ $(GST_BASE_LIBS) $(GST_LIBS) $(LDADD)
+
libs_vc1parser_CFLAGS = \
$(GST_PLUGINS_BAD_CFLAGS) $(GST_PLUGINS_BASE_CFLAGS) \
-DGST_USE_UNSTABLE_API \
diff --git a/tests/check/libs/h265parser.c b/tests/check/libs/h265parser.c
new file mode 100644
index 000000000..0a58e76e5
--- /dev/null
+++ b/tests/check/libs/h265parser.c
@@ -0,0 +1,87 @@
+/* Gstreamer
+ * Copyright (C) <2018> Collabora Ltd.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+#include <gst/check/gstcheck.h>
+#include <gst/codecparsers/gsth265parser.h>
+
+GST_START_TEST (test_h265_base_profiles)
+{
+ GstH265ProfileTierLevel ptl;
+
+ memset (&ptl, 0, sizeof (ptl));
+
+ ptl.profile_idc = 1;
+ g_assert_cmpuint (gst_h265_profile_tier_level_get_profile (&ptl), ==,
+ GST_H265_PROFILE_MAIN);
+ ptl.profile_idc = 2;
+ g_assert_cmpuint (gst_h265_profile_tier_level_get_profile (&ptl), ==,
+ GST_H265_PROFILE_MAIN_10);
+ ptl.profile_idc = 3;
+ g_assert_cmpuint (gst_h265_profile_tier_level_get_profile (&ptl), ==,
+ GST_H265_PROFILE_MAIN_STILL_PICTURE);
+
+ ptl.profile_idc = 42;
+ g_assert_cmpuint (gst_h265_profile_tier_level_get_profile (&ptl), ==,
+ GST_H265_PROFILE_INVALID);
+}
+
+GST_END_TEST;
+
+GST_START_TEST (test_h265_base_profiles_compat)
+{
+ GstH265ProfileTierLevel ptl;
+
+ memset (&ptl, 0, sizeof (ptl));
+
+ ptl.profile_compatibility_flag[1] = 1;
+ g_assert_cmpuint (gst_h265_profile_tier_level_get_profile (&ptl), ==,
+ GST_H265_PROFILE_MAIN);
+ ptl.profile_compatibility_flag[1] = 0;
+
+ ptl.profile_compatibility_flag[2] = 1;
+ g_assert_cmpuint (gst_h265_profile_tier_level_get_profile (&ptl), ==,
+ GST_H265_PROFILE_MAIN_10);
+ ptl.profile_compatibility_flag[2] = 0;
+
+ ptl.profile_compatibility_flag[3] = 1;
+ g_assert_cmpuint (gst_h265_profile_tier_level_get_profile (&ptl), ==,
+ GST_H265_PROFILE_MAIN_STILL_PICTURE);
+ ptl.profile_compatibility_flag[3] = 0;
+
+ ptl.profile_idc = 42;
+ g_assert_cmpuint (gst_h265_profile_tier_level_get_profile (&ptl), ==,
+ GST_H265_PROFILE_INVALID);
+}
+
+GST_END_TEST;
+
+static Suite *
+h265parser_suite (void)
+{
+ Suite *s = suite_create ("H265 Parser library");
+
+ TCase *tc_chain = tcase_create ("general");
+
+ suite_add_tcase (s, tc_chain);
+ tcase_add_test (tc_chain, test_h265_base_profiles);
+ tcase_add_test (tc_chain, test_h265_base_profiles_compat);
+
+ return s;
+}
+
+GST_CHECK_MAIN (h265parser);
diff --git a/tests/check/meson.build b/tests/check/meson.build
index 5b624c207..51da3e449 100644
--- a/tests/check/meson.build
+++ b/tests/check/meson.build
@@ -57,6 +57,7 @@ base_tests = [
[['elements/x265enc.c'], not x265_dep.found(), [x265_dep]],
[['elements/zbar.c'], not zbar_dep.found(), [zbar_dep]],
[['libs/h264parser.c'], false, [gstcodecparsers_dep]],
+ [['libs/h265parser.c'], false, [gstcodecparsers_dep]],
[['libs/insertbin.c'], false, [gstinsertbin_dep]],
[['libs/isoff.c'], not xml2_dep.found(), [gstisoff_dep, xml2_dep]],
[['libs/mpegts.c'], false, [gstmpegts_dep]],