diff options
author | Thiago Santos <ts.santos@sisa.samsung.com> | 2014-05-22 17:49:39 -0300 |
---|---|---|
committer | Edward Hervey <bilboed@bilboed.com> | 2014-05-29 10:38:00 +0200 |
commit | 89fadbcfe433c7a6db3dac9093ffc4b7b6320227 (patch) | |
tree | f96216d5eac1258040f8743fc5661cf25dcde8f2 /tests | |
parent | 0c6bb561e03c564c77510ace2dcc2a4f06c379b2 (diff) | |
download | gstreamer-plugins-bad-89fadbcfe433c7a6db3dac9093ffc4b7b6320227.tar.gz |
tests: mpegts: add test for STT parsing
Specially for the time to UTC datetime conversion
Example taken from the A65 spec
https://bugzilla.gnome.org/show_bug.cgi?id=730435
Diffstat (limited to 'tests')
-rw-r--r-- | tests/check/libs/mpegts.c | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/tests/check/libs/mpegts.c b/tests/check/libs/mpegts.c index 9a652b35b..e1bedff8a 100644 --- a/tests/check/libs/mpegts.c +++ b/tests/check/libs/mpegts.c @@ -62,6 +62,12 @@ static const guint8 sdt_data_check[] = { 0xe5, 0x02, 0xd9 }; +static const guint8 stt_data_check[] = { + 0xcd, 0xf0, 0x11, 0x00, 0x00, 0xc1, 0x00, + 0x00, 0x00, 0x23, 0xb4, 0xe6, 0x5C, 0x0c, + 0xc0, 0x00, 0xc4, 0x86, 0x56, 0xa5 +}; + GST_START_TEST (test_mpegts_pat) { GstMpegTsPatProgram *program; @@ -381,6 +387,41 @@ GST_START_TEST (test_mpegts_sdt) GST_END_TEST; +GST_START_TEST (test_mpegts_atsc_stt) +{ + const GstMpegTsAtscSTT *stt; + GstMpegTsSection *section; + guint8 *data; + GstDateTime *dt; + + data = g_memdup (stt_data_check, 20); + + section = gst_mpegts_section_new (0x1ffb, data, 20); + stt = gst_mpegts_section_get_atsc_stt (section); + fail_if (stt == NULL); + + fail_unless (stt->protocol_version == 0); + fail_unless (stt->system_time == 0x23b4e65c); + fail_unless (stt->gps_utc_offset == 12); + fail_unless (stt->ds_status == 1); + fail_unless (stt->ds_dayofmonth == 0); + fail_unless (stt->ds_hour == 0); + + dt = gst_mpegts_atsc_stt_get_datetime_utc ((GstMpegTsAtscSTT *) stt); + fail_unless (gst_date_time_get_day (dt) == 30); + fail_unless (gst_date_time_get_month (dt) == 12); + fail_unless (gst_date_time_get_year (dt) == 1998); + fail_unless (gst_date_time_get_hour (dt) == 13); + fail_unless (gst_date_time_get_minute (dt) == 0); + fail_unless (gst_date_time_get_second (dt) == 0); + + gst_date_time_unref (dt); + gst_mpegts_section_unref (section); +} + +GST_END_TEST; + + static const guint8 registration_descriptor[] = { 0x05, 0x04, 0x48, 0x44, 0x4d, 0x56 }; @@ -514,6 +555,7 @@ mpegts_suite (void) tcase_add_test (tc_chain, test_mpegts_pmt); tcase_add_test (tc_chain, test_mpegts_nit); tcase_add_test (tc_chain, test_mpegts_sdt); + tcase_add_test (tc_chain, test_mpegts_atsc_stt); tcase_add_test (tc_chain, test_mpegts_descriptors); tcase_add_test (tc_chain, test_mpegts_dvb_descriptors); |