diff options
author | Nicolas Dufresne <nicolas.dufresne@collabora.com> | 2020-05-07 12:02:40 -0400 |
---|---|---|
committer | Nicolas Dufresne <nicolas.dufresne@collabora.com> | 2020-05-07 12:08:36 -0400 |
commit | fd423c8468b9a8c120df0728a738babf9f580301 (patch) | |
tree | 51f14f7d8334ed73123681e8e642c53b06d8d869 /tests | |
parent | 269ab891c574263cb5fdf48de8e396b8418be1f4 (diff) | |
download | gstreamer-plugins-bad-fd423c8468b9a8c120df0728a738babf9f580301.tar.gz |
test: h264/h265: Constify all test buffers
This ensure that no test modify other tests data.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1251>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/check/elements/h264parse.c | 7 | ||||
-rw-r--r-- | tests/check/elements/h265parse.c | 49 | ||||
-rw-r--r-- | tests/check/elements/parser.c | 18 | ||||
-rw-r--r-- | tests/check/elements/parser.h | 24 |
4 files changed, 50 insertions, 48 deletions
diff --git a/tests/check/elements/h264parse.c b/tests/check/elements/h264parse.c index 92a4af03a..e399a30dc 100644 --- a/tests/check/elements/h264parse.c +++ b/tests/check/elements/h264parse.c @@ -842,12 +842,13 @@ static guint8 h264_idr_slice_2[] = { }; static inline GstBuffer * -wrap_buffer (guint8 * buf, gsize size, GstClockTime pts, GstBufferFlags flags) +wrap_buffer (const guint8 * buf, gsize size, GstClockTime pts, + GstBufferFlags flags) { GstBuffer *buffer; buffer = gst_buffer_new_wrapped_full (GST_MEMORY_FLAG_READONLY, - buf, size, 0, size, NULL, NULL); + (gpointer) buf, size, 0, size, NULL, NULL); GST_BUFFER_PTS (buffer) = pts; GST_BUFFER_FLAGS (buffer) |= flags; @@ -859,7 +860,7 @@ composite_buffer (GstClockTime pts, GstBufferFlags flags, gint count, ...) { va_list vl; gint i; - guint8 *data; + const guint8 *data; gsize size; GstBuffer *buffer; diff --git a/tests/check/elements/h265parse.c b/tests/check/elements/h265parse.c index a12adfbef..ff7a4902a 100644 --- a/tests/check/elements/h265parse.c +++ b/tests/check/elements/h265parse.c @@ -50,24 +50,24 @@ GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src", * */ -static guint8 h265_vps[] = { +static const guint8 h265_vps[] = { 0x00, 0x00, 0x00, 0x01, 0x40, 0x01, 0x0c, 0x01, 0xff, 0xff, 0x01, 0x60, 0x00, 0x00, 0x03, 0x00, 0x90, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x3f, 0x95, 0x98, 0x09 }; -static guint8 h265_sps[] = { +static const guint8 h265_sps[] = { 0x00, 0x00, 0x00, 0x01, 0x42, 0x01, 0x01, 0x01, 0x60, 0x00, 0x00, 0x03, 0x00, 0x90, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x3f, 0xa0, 0x88, 0x45, 0x96, 0x56, 0x6a, 0xbc, 0xaf, 0xff, 0x00, 0x01, 0x00, 0x01, 0x6a, 0x0c, 0x02, 0x0c, 0x08, 0x00, 0x00, 0x03, 0x00, 0x08, 0x00, 0x00, 0x03, 0x00, 0xf0, 0x40 }; -static guint8 h265_pps[] = { +static const guint8 h265_pps[] = { 0x00, 0x00, 0x00, 0x01, 0x44, 0x01, 0xc1, 0x73, 0xd0, 0x89 }; -static guint8 h265_idr[] = { +static const guint8 h265_idr[] = { 0x00, 0x00, 0x00, 0x01, 0x26, 0x01, 0xaf, 0x06, 0xb8, 0xcf, 0xbc, 0x65, 0x85, 0x3b, 0x49, 0xff, 0xd0, 0x2c, 0xff, 0x3b, 0x61, 0x6d, 0x1b, 0xae, 0xf1, 0xf4, 0x96, 0x15, 0xef, 0x3e, 0xc6, 0x67, 0x3c, 0x0a, 0xd0, 0x6a, 0xb9, 0xfb, 0xf8, @@ -95,12 +95,12 @@ static guint8 h265_idr[] = { }; /* Content light level information SEI message */ -static guint8 h265_sei_clli[] = { +static const guint8 h265_sei_clli[] = { 0x00, 0x00, 0x00, 0x01, 0x4e, 0x01, 0x90, 0x04, 0x03, 0xe8, 0x01, 0x90, 0x80 }; /* Mastering display colour volume information SEI message */ -static guint8 h265_sei_mdcv[] = { +static const guint8 h265_sei_mdcv[] = { 0x00, 0x00, 0x00, 0x01, 0x4e, 0x01, 0x89, 0x18, 0x33, 0xc2, 0x86, 0xc4, 0x1d, 0x4c, 0x0b, 0xb8, 0x84, 0xd0, 0x3e, 0x80, 0x3d, 0x13, 0x40, 0x42, 0x00, 0x98, 0x96, 0x80, 0x00, 0x00, 0x03, 0x00, 0x01, 0x80 @@ -114,14 +114,14 @@ static guint8 h265_sei_mdcv[] = { * ! fakesink dump=1 */ -static guint8 h265_128x128_vps[] = { +static const guint8 h265_128x128_vps[] = { 0x00, 0x00, 0x00, 0x01, 0x40, 0x01, 0x0c, 0x01, 0xff, 0xff, 0x01, 0x60, 0x00, 0x00, 0x03, 0x00, 0x90, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x3f, 0x95, 0x98, 0x09 }; -static guint8 h265_128x128_sps[] = { +static const guint8 h265_128x128_sps[] = { 0x00, 0x00, 0x00, 0x01, 0x42, 0x01, 0x01, 0x01, 0x60, 0x00, 0x00, 0x03, 0x00, 0x90, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x3f, 0xa0, 0x10, @@ -131,12 +131,12 @@ static guint8 h265_128x128_sps[] = { 0x08 }; -static guint8 h265_128x128_pps[] = { +static const guint8 h265_128x128_pps[] = { 0x00, 0x00, 0x00, 0x01, 0x44, 0x01, 0xc1, 0x72, 0xb4, 0x22, 0x40 }; -static guint8 h265_128x128_slice_idr_n_lp[] = { +static const guint8 h265_128x128_slice_idr_n_lp[] = { 0x00, 0x00, 0x00, 0x01, 0x28, 0x01, 0xaf, 0x0e, 0xe0, 0x34, 0x82, 0x15, 0x84, 0xf4, 0x70, 0x4f, 0xff, 0xed, 0x41, 0x3f, 0xff, 0xe4, 0xcd, 0xc4, @@ -151,14 +151,14 @@ static guint8 h265_128x128_slice_idr_n_lp[] = { * ! fakesink dump=1 */ -static guint8 h265_128x128_sliced_vps[] = { +static const guint8 h265_128x128_sliced_vps[] = { 0x00, 0x00, 0x00, 0x01, 0x40, 0x01, 0x0c, 0x01, 0xff, 0xff, 0x01, 0x40, 0x00, 0x00, 0x03, 0x00, 0x90, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x1e, 0x25, 0x02, 0x40 }; -static guint8 h265_128x128_sliced_sps[] = { +static const guint8 h265_128x128_sliced_sps[] = { 0x00, 0x00, 0x00, 0x01, 0x42, 0x01, 0x01, 0x01, 0x40, 0x00, 0x00, 0x03, 0x00, 0x90, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x1e, 0xa0, 0x10, @@ -169,19 +169,19 @@ static guint8 h265_128x128_sliced_sps[] = { 0x01, 0x04 }; -static guint8 h265_128x128_sliced_pps[] = { +static const guint8 h265_128x128_sliced_pps[] = { 0x00, 0x00, 0x00, 0x01, 0x44, 0x01, 0xc0, 0x71, 0x81, 0x8d, 0xb2 }; -static guint8 h265_128x128_slice_1_idr_n_lp[] = { +static const guint8 h265_128x128_slice_1_idr_n_lp[] = { 0x00, 0x00, 0x00, 0x01, 0x28, 0x01, 0xac, 0x46, 0x13, 0xb6, 0x45, 0x43, 0xaf, 0xee, 0x3d, 0x3f, 0x76, 0xe5, 0x73, 0x2f, 0xee, 0xd2, 0xeb, 0xbf, 0x80 }; -static guint8 h265_128x128_slice_2_idr_n_lp[] = { +static const guint8 h265_128x128_slice_2_idr_n_lp[] = { 0x00, 0x00, 0x00, 0x01, 0x28, 0x01, 0x30, 0xc4, 0x60, 0x13, 0xb6, 0x45, 0x43, 0xaf, 0xee, 0x3d, 0x3f, 0x76, 0xe5, 0x73, 0x2f, 0xee, 0xd2, 0xeb, @@ -352,12 +352,13 @@ h265parse_suite (void) /* helper methods for GstHasness based tests */ static inline GstBuffer * -wrap_buffer (guint8 * buf, gsize size, GstClockTime pts, GstBufferFlags flags) +wrap_buffer (const guint8 * buf, gsize size, GstClockTime pts, + GstBufferFlags flags) { GstBuffer *buffer; buffer = gst_buffer_new_wrapped_full (GST_MEMORY_FLAG_READONLY, - buf, size, 0, size, NULL, NULL); + (gpointer) buf, size, 0, size, NULL, NULL); GST_BUFFER_PTS (buffer) = pts; GST_BUFFER_FLAGS (buffer) |= flags; @@ -369,7 +370,7 @@ composite_buffer (GstClockTime pts, GstBufferFlags flags, gint count, ...) { va_list vl; gint i; - guint8 *data; + const guint8 *data; gsize size; GstBuffer *buffer; @@ -391,7 +392,7 @@ composite_buffer (GstClockTime pts, GstBufferFlags flags, gint count, ...) } static inline void -pull_and_check_full (GstHarness * h, guint8 * data, gsize size, +pull_and_check_full (GstHarness * h, const guint8 * data, gsize size, GstClockTime pts, GstBufferFlags flags) { GstBuffer *b = gst_harness_pull (h); @@ -426,16 +427,16 @@ pull_and_check_full (GstHarness * h, guint8 * data, gsize size, } G_STMT_END #define HEADER_DATA \ - guint8 * const vps = sliced ? h265_128x128_sliced_vps : h265_128x128_vps; \ - guint8 * const sps = sliced ? h265_128x128_sliced_sps : h265_128x128_sps; \ - guint8 * const pps = sliced ? h265_128x128_sliced_pps : h265_128x128_pps; \ + const guint8 * const vps = sliced ? h265_128x128_sliced_vps : h265_128x128_vps; \ + const guint8 * const sps = sliced ? h265_128x128_sliced_sps : h265_128x128_sps; \ + const guint8 * const pps = sliced ? h265_128x128_sliced_pps : h265_128x128_pps; \ const gsize vps_size = sliced ? sizeof (h265_128x128_sliced_vps) : sizeof (h265_128x128_vps); \ const gsize sps_size = sliced ? sizeof (h265_128x128_sliced_sps) : sizeof (h265_128x128_sps); \ const gsize pps_size = sliced ? sizeof (h265_128x128_sliced_pps) : sizeof (h265_128x128_pps) #define SLICE_DATA \ - guint8 * const slice_1 = sliced ? h265_128x128_slice_1_idr_n_lp : h265_128x128_slice_idr_n_lp; \ - guint8 * const slice_2 = sliced ? h265_128x128_slice_2_idr_n_lp : NULL; \ + const guint8 * const slice_1 = sliced ? h265_128x128_slice_1_idr_n_lp : h265_128x128_slice_idr_n_lp; \ + const guint8 * const slice_2 = sliced ? h265_128x128_slice_2_idr_n_lp : NULL; \ const gsize slice_1_size = sliced ? sizeof (h265_128x128_slice_1_idr_n_lp) : sizeof (h265_128x128_slice_idr_n_lp); \ const gsize slice_2_size = sliced ? sizeof (h265_128x128_slice_2_idr_n_lp) : 0 diff --git a/tests/check/elements/parser.c b/tests/check/elements/parser.c index 00608472a..da2a453d2 100644 --- a/tests/check/elements/parser.c +++ b/tests/check/elements/parser.c @@ -194,7 +194,7 @@ cleanup_element (GstElement * element) /* inits a standard test */ void -gst_parser_test_init (GstParserTest * ptest, guint8 * data, guint size, +gst_parser_test_init (GstParserTest * ptest, const guint8 * data, guint size, guint num) { /* need these */ @@ -318,7 +318,7 @@ gst_parser_test_run (GstParserTest * test, GstCaps ** out_caps) * Test if the parser pushes clean data properly. */ void -gst_parser_test_normal (guint8 * data, guint size) +gst_parser_test_normal (const guint8 * data, guint size) { GstParserTest ptest; @@ -333,7 +333,7 @@ gst_parser_test_normal (guint8 * data, guint size) * about stream format. But it should still push the frame forward in EOS. */ void -gst_parser_test_drain_single (guint8 * data, guint size) +gst_parser_test_drain_single (const guint8 * data, guint size) { GstParserTest ptest; @@ -345,8 +345,8 @@ gst_parser_test_drain_single (guint8 * data, guint size) * Make sure that parser does not drain garbage when EOS occurs. */ void -gst_parser_test_drain_garbage (guint8 * data, guint size, guint8 * garbage, - guint gsize) +gst_parser_test_drain_garbage (const guint8 * data, guint size, + guint8 * garbage, guint gsize) { GstParserTest ptest; @@ -362,7 +362,7 @@ gst_parser_test_drain_garbage (guint8 * data, guint size, guint8 * garbage, * separate buffers properly. */ void -gst_parser_test_split (guint8 * data, guint size) +gst_parser_test_split (const guint8 * data, guint size) { GstParserTest ptest; @@ -375,7 +375,7 @@ gst_parser_test_split (guint8 * data, guint size) * Test if the parser skips garbage between frames properly. */ void -gst_parser_test_skip_garbage (guint8 * data, guint size, guint8 * garbage, +gst_parser_test_skip_garbage (const guint8 * data, guint size, guint8 * garbage, guint gsize) { GstParserTest ptest; @@ -394,7 +394,7 @@ gst_parser_test_skip_garbage (guint8 * data, guint size, guint8 * garbage, * Test if the src caps are set according to stream format. */ void -gst_parser_test_output_caps (guint8 * data, guint size, +gst_parser_test_output_caps (const guint8 * data, guint size, const gchar * input_caps, const gchar * output_caps) { GstParserTest ptest; @@ -419,7 +419,7 @@ gst_parser_test_output_caps (guint8 * data, guint size, * Test if the src caps are set according to stream format. */ GstCaps * -gst_parser_test_get_output_caps (guint8 * data, guint size, +gst_parser_test_get_output_caps (const guint8 * data, guint size, const gchar * input_caps) { GstParserTest ptest; diff --git a/tests/check/elements/parser.h b/tests/check/elements/parser.h index b28e6b4b1..dc447ae56 100644 --- a/tests/check/elements/parser.h +++ b/tests/check/elements/parser.h @@ -43,8 +43,8 @@ typedef struct } buffer_verify_data_s; typedef struct { - guint8 *data; - guint size; + const guint8 *data; + guint size; } datablob; typedef gboolean (*VerifyBuffer) (buffer_verify_data_s * vdata, GstBuffer * buf); @@ -84,8 +84,8 @@ typedef struct /* series of buffers; middle series considered garbage */ struct { /* data and size */ - guint8 *data; - guint size; + const guint8 *data; + guint size; /* num of frames with above data per buffer */ guint fpb; /* num of buffers */ @@ -98,30 +98,30 @@ typedef struct } GstParserTest; extern -void gst_parser_test_init (GstParserTest * ptest, guint8 * data, guint size, guint num); +void gst_parser_test_init (GstParserTest * ptest, const guint8 * data, guint size, guint num); extern void gst_parser_test_run (GstParserTest * test, GstCaps ** out_caps); extern -void gst_parser_test_normal (guint8 *data, guint size); +void gst_parser_test_normal (const guint8 *data, guint size); extern -void gst_parser_test_drain_single (guint8 *data, guint size); +void gst_parser_test_drain_single (const guint8 *data, guint size); extern -void gst_parser_test_drain_garbage (guint8 *data, guint size, guint8 *garbage, guint gsize); +void gst_parser_test_drain_garbage (const guint8 *data, guint size, guint8 *garbage, guint gsize); extern -void gst_parser_test_split (guint8 *data, guint size); +void gst_parser_test_split (const guint8 *data, guint size); extern -void gst_parser_test_skip_garbage (guint8 *data, guint size, guint8 *garbage, guint gsize); +void gst_parser_test_skip_garbage (const guint8 *data, guint size, guint8 *garbage, guint gsize); extern -void gst_parser_test_output_caps (guint8 *data, guint size, const gchar * input_caps, +void gst_parser_test_output_caps (const guint8 *data, guint size, const gchar * input_caps, const gchar * output_caps); extern -GstCaps *gst_parser_test_get_output_caps (guint8 *data, guint size, const gchar * input_caps); +GstCaps *gst_parser_test_get_output_caps (const guint8 *data, guint size, const gchar * input_caps); |