diff options
Diffstat (limited to 'tests/check/libs/h265parser.c')
-rw-r--r-- | tests/check/libs/h265parser.c | 87 |
1 files changed, 87 insertions, 0 deletions
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); |